-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathbzfsAPI.h
More file actions
2450 lines (2006 loc) · 65 KB
/
bzfsAPI.h
File metadata and controls
2450 lines (2006 loc) · 65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* bzflag
* Copyright (c) 1993-2018 Tim Riker
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the license found in the file
* named COPYING that should have accompanied this file.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
// all the exported functions for bzfs plugins
#ifndef _BZFS_API_H_
#define _BZFS_API_H_
/* system interface headers */
#include <string>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <stdint.h>
/* DO NOT INCLUDE ANY OTHER HEADERS IN THIS FILE */
/* PLUGINS NEED TO BE BUILT WITHOUT THE BZ SOURCE TREE */
/* JUST THIS ONE FILE */
#ifdef _WIN32
#pragma warning( disable : 4996 )
#ifdef INSIDE_BZ
#define BZF_API __declspec( dllexport )
#else
#define BZF_API __declspec( dllimport )
#endif
#define BZF_PLUGIN_CALL extern "C" __declspec( dllexport )
#ifndef strcasecmp
#define strcasecmp stricmp
#endif
#else
#define BZF_API
#define BZF_PLUGIN_CALL extern "C"
#endif
/* Provide a means to deprecate API functions to discourage their use
* in the future
*/
#ifdef __GNUC__
# define DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
# define DEPRECATED __declspec(deprecated)
#else
# pragma message("WARNING: You need to implement DEPRECATED for this compiler")
# define DEPRECATED
#endif
class bz_Plugin;
#define BZ_API_VERSION 26
#define BZ_GET_PLUGIN_VERSION BZF_PLUGIN_CALL int bz_GetMinVersion ( void ) { return BZ_API_VERSION; }
#define BZ_PLUGIN(n)\
BZF_PLUGIN_CALL bz_Plugin* bz_GetPlugin ( void ) { return new n; }\
BZF_PLUGIN_CALL void bz_FreePlugin ( bz_Plugin* plugin ) { delete(plugin); }\
BZF_PLUGIN_CALL int bz_GetMinVersion ( void ) { return BZ_API_VERSION; }
/** This is so we can use gcc's "format string vs arguments"-check
* for various printf-like functions, and still maintain compatability.
* Not tested on other platforms yet, but should work. */
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
* are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
/** shorthand defines to make the code cleaner. */
#define _ATTRIBUTE34 __attribute__ ((__format__ (__printf__, 3, 4)))
#define _ATTRIBUTE23 __attribute__ ((__format__ (__printf__, 2, 3)))
#define _ATTRIBUTE12 __attribute__ ((__format__ (__printf__, 1, 2)))
#ifdef __cplusplus
# ifndef DEFINED_FORCE_CAST
# define DEFINED_FORCE_CAST
template<class To, class From>
inline To force_cast(From const & f)
{
union
{
From f;
To t;
} fc;
fc.f = f;
return fc.t;
}
# endif
#endif
typedef enum
{
eGoodFlag = 0,
eBadFlag,
eLastFlagQuality
} bz_eFlagQuality;
//utility classes
class BZF_API bz_ApiString
{
public:
bz_ApiString();
bz_ApiString(const char* c);
bz_ApiString(const std::string &s);
bz_ApiString(const bz_ApiString &r);
~bz_ApiString();
bz_ApiString& operator=( const bz_ApiString& r );
bz_ApiString& operator=( const std::string& r );
bz_ApiString& operator=( const char* r );
bool operator==( const bz_ApiString&r );
bool operator==( const std::string& r );
bool operator==( const char* r );
bool operator!=( const bz_ApiString&r );
bool operator!=( const std::string& r );
bool operator!=( const char* r );
bz_ApiString& operator+=( const bz_ApiString& r );
bz_ApiString& operator+=( const std::string& r );
bz_ApiString& operator+=( const char* r );
unsigned int size ( void ) const;
bool empty ( void ) const;
const char* c_str(void) const;
void format(const char* fmt, ...);
void replaceAll ( const char* target, const char* with );
void tolower ( void );
void toupper ( void );
void urlEncode ( void );
protected:
class dataBlob
{
public:
std::string str;
};
dataBlob *data;
public:
// Conversion/cast operator
operator std::string() const
{
return this->data->str;
}
};
class BZF_API bz_APIIntList
{
public:
bz_APIIntList();
bz_APIIntList(const bz_APIIntList &r);
bz_APIIntList(const std::vector<int> &r);
~bz_APIIntList();
void push_back ( int value );
int get ( unsigned int i );
const int& operator[](unsigned int i) const;
bz_APIIntList& operator=( const bz_APIIntList& r );
bz_APIIntList& operator=( const std::vector<int>& r );
unsigned int size ( void );
void clear ( void );
protected:
class dataBlob;
dataBlob *data;
};
BZF_API bz_APIIntList* bz_newIntList ( void );
BZF_API void bz_deleteIntList( bz_APIIntList * l );
class BZF_API bz_APIFloatList
{
public:
bz_APIFloatList();
bz_APIFloatList(const bz_APIFloatList &r);
bz_APIFloatList(const std::vector<float> &r);
~bz_APIFloatList();
void push_back ( float value );
float get ( unsigned int i );
const float& operator[](unsigned int i) const;
bz_APIFloatList& operator=( const bz_APIFloatList& r );
bz_APIFloatList& operator=( const std::vector<float>& r );
unsigned int size ( void );
void clear ( void );
protected:
class dataBlob;
dataBlob *data;
};
BZF_API bz_APIFloatList* bz_newFloatList ( void );
BZF_API void bz_deleteFloatList( bz_APIFloatList * l );
class BZF_API bz_APIStringList
{
public:
bz_APIStringList();
bz_APIStringList(const bz_APIStringList &r);
bz_APIStringList(const std::vector<std::string> &r);
~bz_APIStringList();
void push_back ( const bz_ApiString &value );
void push_back ( const std::string &value );
bz_ApiString get ( unsigned int i ) const;
const bz_ApiString& operator[](unsigned int i) const;
bz_APIStringList& operator=( const bz_APIStringList& r );
bz_APIStringList& operator=( const std::vector<std::string>& r );
const char* join(const char* delimiter = ",");
bool contains(const std::string &needle);
unsigned int size ( void ) const;
void clear ( void );
void tokenize ( const char* in, const char* delims, int maxTokens = 0, bool useQuotes = false);
protected:
class dataBlob;
dataBlob *data;
};
BZF_API bz_APIStringList* bz_newStringList ( void );
BZF_API void bz_deleteStringList( bz_APIStringList * l );
// current time (leave method here, used in bz_EventData constructor)
BZF_API double bz_getCurrentTime(void);
// versioning
BZF_API int bz_APIVersion ( void );
// event stuff
typedef enum
{
bz_eNullEvent = 0,
bz_eCaptureEvent,
bz_ePlayerDieEvent,
bz_ePlayerSpawnEvent,
bz_eZoneEntryEvent,
bz_eZoneExitEvent,
bz_ePlayerJoinEvent,
bz_ePlayerPartEvent,
bz_eRawChatMessageEvent, // before filter
bz_eFilteredChatMessageEvent, // after filter
bz_eUnknownSlashCommand,
bz_eGetPlayerSpawnPosEvent,
bz_eGetAutoTeamEvent,
bz_eAllowPlayer,
bz_eTickEvent,
bz_eGetWorldEvent,
bz_eGetPlayerInfoEvent,
bz_eAllowSpawn,
bz_eListServerUpdateEvent,
bz_eBanEvent,
bz_eHostBanModifyEvent,
bz_eKickEvent,
bz_eKillEvent,
bz_ePlayerPausedEvent,
bz_eMessageFilteredEvent,
bz_eGamePauseEvent,
bz_eGameResumeEvent,
bz_eGameStartEvent,
bz_eGameEndEvent,
bz_eSlashCommandEvent,
bz_ePlayerAuthEvent,
bz_eServerMsgEvent,
bz_eShotFiredEvent,
bz_ePlayerUpdateEvent,
bz_eNetDataSendEvent,
bz_eNetDataReceiveEvent,
bz_eLoggingEvent,
bz_eShotEndedEvent,
bz_eFlagTransferredEvent,
bz_eFlagGrabbedEvent,
bz_eFlagDroppedEvent,
bz_eAllowCTFCaptureEvent,
bz_eMsgDebugEvent,
bz_eNewNonPlayerConnection,
bz_ePluginLoaded,
bz_ePluginUnloaded,
bz_ePlayerScoreChanged,
bz_eTeamScoreChanged,
bz_eWorldFinalized,
bz_eReportFiledEvent,
bz_eBZDBChange,
bz_eGetPlayerMotto,
bz_eAllowConnection,
bz_eAllowFlagGrab,
bz_eAuthenticatonComplete,
bz_eServerAddPlayer,
bz_eAllowPollEvent,
bz_ePollStartEvent,
bz_ePollVoteEvent,
bz_ePollVetoEvent,
bz_ePollEndEvent,
bz_eComputeHandicapEvent,
bz_eBeginHandicapRefreshEvent,
bz_eEndHandicapRefreshEvent,
bz_eAutoPilotEvent,
bz_eMuteEvent,
bz_eUnmuteEvent,
bz_eServerShotFiredEvent,
bz_ePermissionModificationEvent,
bz_eAllowServerShotFiredEvent,
bz_ePlayerDeathFinalizedEvent,
bz_eReloadEvent,
bz_eLastEvent //this is never used as an event, just show it's the last one
} bz_eEventType;
// permision #defines
#define bz_perm_actionMessage "actionMessage"
#define bz_perm_adminMessageReceive "adminMessageReceive"
#define bz_perm_adminMessageSend "adminMessageSend"
#define bz_perm_antiban "antiban"
#define bz_perm_antikick "antikick"
#define bz_perm_antikill "antikill"
#define bz_perm_antipoll "antipoll"
#define bz_perm_antipollban "antipollban"
#define bz_perm_antipollkick "antipollkick"
#define bz_perm_antipollkill "antipollkill"
#define bz_perm_ban "ban"
#define bz_perm_banlist "banlist"
#define bz_perm_clientQuery "clientQuery"
#define bz_perm_countdown "countdown"
#define bz_perm_date "date"
#define bz_perm_endGame "endGame"
#define bz_perm_flagHistory "flagHistory"
#define bz_perm_flagMod "flagMod"
#define bz_perm_hideAdmin "hideAdmin"
#define bz_perm_idleStats "idleStats"
#define bz_perm_info "info"
#define bz_perm_kick "kick"
#define bz_perm_kill "kill"
#define bz_perm_lagStats "lagStats"
#define bz_perm_lagwarn "lagwarn"
#define bz_perm_listPerms "listPerms"
#define bz_perm_listPlugins "listPlugins"
#define bz_perm_masterBan "masterban"
#define bz_perm_mute "mute"
#define bz_perm_playerList "playerList"
#define bz_perm_plugins "plugins"
#define bz_perm_poll "poll"
#define bz_perm_pollBan "pollBan"
#define bz_perm_pollKick "pollKick"
#define bz_perm_pollKill "pollKill"
#define bz_perm_pollSet "pollSet"
#define bz_perm_pollFlagReset "pollFlagReset"
#define bz_perm_privateMessage "privateMessage"
#define bz_perm_record "record"
#define bz_perm_rejoin "rejoin"
#define bz_perm_removePerms "removePerms"
#define bz_perm_replay "replay"
#define bz_perm_report "report"
#define bz_perm_say "say"
#define bz_perm_sendHelp "sendHelp"
#define bz_perm_setAll "setAll"
#define bz_perm_setPerms "setPerms"
#define bz_perm_setVar "setVar"
#define bz_perm_showAdmin "showAdmin"
#define bz_perm_showMotto "showMotto"
#define bz_perm_showOthers "showOthers"
#define bz_perm_shortBan "shortBan"
#define bz_perm_shutdownServer "shutdownServer"
#define bz_perm_spawn "spawn"
#define bz_perm_superKill "superKill"
#define bz_perm_talk "talk"
#define bz_perm_unban "unban"
#define bz_perm_unmute "unmute"
#define bz_perm_veto "veto"
#define bz_perm_viewReports "viewReports"
#define bz_perm_vote "vote"
// types of text messages
typedef enum
{
eChatMessage,
eActionMessage
} bz_eMessageType;
typedef enum
{
eNoTeam = -1,
eRogueTeam = 0,
eRedTeam,
eGreenTeam,
eBlueTeam,
ePurpleTeam,
eRabbitTeam,
eHunterTeam,
eObservers,
eAdministrators
} bz_eTeamType;
#define BZ_SERVER -2
#define BZ_ALLUSERS -1
#define BZ_NULLUSER -3
#define BZ_PUBLICCHAT 254
#define BZ_ADMINCHAT 252
#define BZ_ROGUECHAT 251
#define BZ_REDCHAT 250
#define BZ_GREENCHAT 249
#define BZ_BLUECHAT 248
#define BZ_PURPLECHAT 247
#define BZ_OBSERVERCHAT 246
#define BZ_RABBITCHAT 245
#define BZ_HUNTERCHAT 244
#define BZ_SERVERPLAYER 253
#define BZ_LASTREALPLAYER 243
#define BZ_BZDBPERM_NA 0
#define BZ_BZDBPERM_USER 1
#define BZ_BZDBPERM_SERVER 2
#define BZ_BZDBPERM_CLIENT 3
typedef enum
{
eFFAGame= 0,
eOpenFFAGame,
eCTFGame,
eRabbitGame
} bz_eGameType;
// defined later but used in some event objects
class bz_BasePlayerRecord;
typedef enum
{
eDead, // not alive, not paused, etc.
eAlive, // player is alive
ePaused, // player is paused
eExploding, // currently blowing up
eTeleporting // teleported recently
} bz_ePlayerStatus;
typedef struct bz_PlayerUpdateState
{
bz_ePlayerStatus status; // special states
bool falling; // not driving on the ground or an obstacle
bool crossingWall; // crossing an obstacle wall
bool inPhantomZone; // zoned
float pos[3]; // position of tank
float velocity[3]; // velocity of tank
float rotation; // orientation of tank
float angVel; // angular velocity of tank
int phydrv; // physics driver
} bz_PlayerUpdateState;
BZF_API bool bz_freePlayerRecord ( bz_BasePlayerRecord *playerRecord );
// event data types
class BZF_API bz_EventData
{
public:
bz_EventData(bz_eEventType type = bz_eNullEvent)
: version(1), eventType(type), eventTime( bz_getCurrentTime() )
{
}
virtual ~bz_EventData() {}
virtual void update() {}
int version;
bz_eEventType eventType;
double eventTime;
};
class BZF_API bz_CTFCaptureEventData_V1 : public bz_EventData
{
public:
bz_CTFCaptureEventData_V1() : bz_EventData(bz_eCaptureEvent)
, teamCapped(eNoTeam), teamCapping(eNoTeam), playerCapping(-1)
, rot(0.0)
{
memset(pos,0,sizeof(float)*3);
}
bz_eTeamType teamCapped;
bz_eTeamType teamCapping;
int playerCapping;
float pos[3];
float rot;
};
class BZF_API bz_PlayerDieEventData_V1 : public bz_EventData
{
public:
bz_PlayerDieEventData_V1() : bz_EventData(bz_ePlayerDieEvent)
, playerID(-1), team(eNoTeam), killerID(-1), killerTeam(eNoTeam)
, shotID(-1), driverID(-1), state()
{
}
int playerID;
bz_eTeamType team;
int killerID;
bz_eTeamType killerTeam;
bz_ApiString flagKilledWith;
int shotID;
int driverID;
bz_PlayerUpdateState state;
};
class BZF_API bz_PlayerDieEventData_V2 : public bz_PlayerDieEventData_V1
{
public:
bz_PlayerDieEventData_V2() : bz_PlayerDieEventData_V1()
, flagHeldWhenKilled(-1)
{}
int flagHeldWhenKilled;
};
class BZF_API bz_PlayerSpawnEventData_V1 : public bz_EventData
{
public:
bz_PlayerSpawnEventData_V1() : bz_EventData(bz_ePlayerSpawnEvent)
, playerID(-1), team(eNoTeam), state()
{
}
int playerID;
bz_eTeamType team;
bz_PlayerUpdateState state;
};
class BZF_API bz_ChatEventData_V1 : public bz_EventData
{
public:
bz_ChatEventData_V1() : bz_EventData(bz_eRawChatMessageEvent)
, from(-1), to(-1), team(eNoTeam)
{
}
int from;
int to;
bz_eTeamType team;
bz_ApiString message;
};
class BZF_API bz_ChatEventData_V2 : public bz_ChatEventData_V1
{
public:
bz_ChatEventData_V2() : bz_ChatEventData_V1()
, messageType(eChatMessage)
{
}
bz_eMessageType messageType;
};
class BZF_API bz_PlayerJoinPartEventData_V1 : public bz_EventData
{
public:
bz_PlayerJoinPartEventData_V1() : bz_EventData(bz_ePlayerJoinEvent)
, playerID(-1), record(0)
{
}
~bz_PlayerJoinPartEventData_V1()
{
bz_freePlayerRecord(record);
}
int playerID;
bz_BasePlayerRecord* record;
bz_ApiString reason;
};
class BZF_API bz_UnknownSlashCommandEventData_V1 : public bz_EventData
{
public:
bz_UnknownSlashCommandEventData_V1() : bz_EventData(bz_eUnknownSlashCommand)
, from(-1), handled(false)
{
}
int from;
bool handled;
bz_ApiString message;
};
class BZF_API bz_GetPlayerSpawnPosEventData_V1 : public bz_EventData
{
public:
bz_GetPlayerSpawnPosEventData_V1() : bz_EventData(bz_eGetPlayerSpawnPosEvent)
, playerID(-1), team(eNoTeam), handled(false)
, rot(0.0)
{
pos[0] = pos[1] = pos[2] = 0.0f;
}
int playerID;
bz_eTeamType team;
bool handled;
float pos[3];
float rot;
};
class BZF_API bz_AllowPlayerEventData_V1 : public bz_EventData
{
public:
bz_AllowPlayerEventData_V1() : bz_EventData(bz_eAllowPlayer)
, playerID(-1)
, allow(true)
{
}
int playerID;
bz_ApiString callsign;
bz_ApiString ipAddress;
bz_ApiString reason;
bool allow;
};
class BZF_API bz_TickEventData_V1 : public bz_EventData
{
public:
bz_TickEventData_V1() : bz_EventData(bz_eTickEvent)
{
}
};
class BZF_API bz_GetWorldEventData_V1 : public bz_EventData
{
public:
bz_GetWorldEventData_V1() : bz_EventData(bz_eGetWorldEvent)
, generated(false)
, ctf(false)
, rabbit(false)
, openFFA(false)
, worldBlob(NULL)
{
}
bool generated;
bool ctf;
bool rabbit;
bool openFFA;
bz_ApiString worldFile;
char* worldBlob; // if assigned, the world will be read from this NUL
// terminated string. BZFS does not free this memory,
// so the plugin must do so (this can be done in the
// WorldFinalize event)
};
class BZF_API bz_GetPlayerInfoEventData_V1 : public bz_EventData
{
public:
bz_GetPlayerInfoEventData_V1() : bz_EventData(bz_eGetPlayerInfoEvent)
, playerID(-1), team(eNoTeam)
, admin(false), verified(false), registered(false)
{
}
int playerID;
bz_ApiString callsign;
bz_ApiString ipAddress;
bz_eTeamType team;
bool admin;
bool verified;
bool registered;
};
class BZF_API bz_GetAutoTeamEventData_V1 : public bz_EventData
{
public:
bz_GetAutoTeamEventData_V1() : bz_EventData(bz_eGetAutoTeamEvent)
, playerID(-1), team(eNoTeam)
, handled(false)
{
}
int playerID;
bz_ApiString callsign;
bz_eTeamType team;
bool handled;
};
class BZF_API bz_AllowSpawnData_V1 : public bz_EventData
{
public:
bz_AllowSpawnData_V1() : bz_EventData(bz_eAllowSpawn)
, playerID(-1), team(eNoTeam)
, handled(false), allow(true)
{
}
int playerID;
bz_eTeamType team;
bool handled;
bool allow;
};
class BZF_API bz_AllowSpawnData_V2 : public bz_AllowSpawnData_V1
{
public:
bz_AllowSpawnData_V2() : bz_AllowSpawnData_V1()
, kickPlayer(true), kickReason("Not allowed to spawn")
, message("You are not allowed to spawn. Please contact an administrator.")
{
}
bool kickPlayer;
bz_ApiString kickReason;
bz_ApiString message;
};
class BZF_API bz_ListServerUpdateEvent_V1 : public bz_EventData
{
public:
bz_ListServerUpdateEvent_V1() : bz_EventData(bz_eListServerUpdateEvent)
, handled(false)
{
}
bz_ApiString address;
bz_ApiString description;
bz_ApiString groups;
bool handled;
};
class BZF_API bz_BanEventData_V1 : public bz_EventData
{
public:
bz_BanEventData_V1() : bz_EventData(bz_eBanEvent)
, bannerID(-1), banneeID(-1), duration(-1)
{
}
int bannerID;
int banneeID;
int duration;
bz_ApiString ipAddress;
bz_ApiString reason;
};
class BZF_API bz_HostBanEventData_V1 : public bz_EventData
{
public:
bz_HostBanEventData_V1() : bz_EventData(bz_eHostBanModifyEvent)
, bannerID(-1), duration(-1)
{
}
int bannerID;
int duration;
bz_ApiString hostPattern;
bz_ApiString reason;
};
class BZF_API bz_KickEventData_V1 : public bz_EventData
{
public:
bz_KickEventData_V1() : bz_EventData(bz_eKickEvent)
, kickerID(-1), kickedID(-1)
{
}
int kickerID;
int kickedID;
bz_ApiString reason;
};
class BZF_API bz_KillEventData_V1 : public bz_EventData
{
public:
bz_KillEventData_V1() : bz_EventData(bz_eKillEvent)
, killerID(-1), killedID(-1)
{
}
int killerID;
int killedID;
bz_ApiString reason;
};
class BZF_API bz_PlayerPausedEventData_V1 : public bz_EventData
{
public:
bz_PlayerPausedEventData_V1() : bz_EventData(bz_ePlayerPausedEvent)
, playerID(-1), pause(false)
{
}
int playerID;
bool pause;
};
class BZF_API bz_MessageFilteredEventData_V1 : public bz_EventData
{
public:
bz_MessageFilteredEventData_V1() : bz_EventData(bz_eMessageFilteredEvent)
, playerID(-1)
{
}
int playerID;
bz_ApiString rawMessage;
bz_ApiString filteredMessage;
};
class BZF_API bz_GamePauseResumeEventData_V1 : public bz_EventData
{
public:
bz_GamePauseResumeEventData_V1() : bz_EventData(bz_eGameResumeEvent)
, actionBy("SERVER")
{
}
bz_ApiString actionBy;
};
class BZF_API bz_GamePauseResumeEventData_V2 : public bz_GamePauseResumeEventData_V1
{
public:
bz_GamePauseResumeEventData_V2() : bz_GamePauseResumeEventData_V1()
, playerID(253)
{
}
int playerID;
};
class BZF_API bz_GameStartEndEventData_V1 : public bz_EventData
{
public:
bz_GameStartEndEventData_V1() : bz_EventData(bz_eGameStartEvent)
, duration(0.0)
{
}
double duration;
};
class BZF_API bz_GameStartEndEventData_V2 : public bz_GameStartEndEventData_V1
{
public:
bz_GameStartEndEventData_V2() : bz_GameStartEndEventData_V1()
, playerID(253), gameOver(false)
{
}
int playerID;
bool gameOver;
};
class BZF_API bz_SlashCommandEventData_V1 : public bz_EventData
{
public:
bz_SlashCommandEventData_V1() : bz_EventData(bz_eSlashCommandEvent)
, from(-1)
{
}
int from;
bz_ApiString message;
};
class BZF_API bz_SlashCommandEventData_V2 : public bz_SlashCommandEventData_V1
{
public:
bz_SlashCommandEventData_V2() : bz_SlashCommandEventData_V1(), sourceChannel(-1)
{
}
int sourceChannel;
};
class BZF_API bz_AllowPollEventData_V1 : public bz_EventData
{
public:
bz_AllowPollEventData_V1() : bz_EventData(bz_eAllowPollEvent),
playerID(BZ_SERVER), pollAction(""), pollTarget(""), allow(true), reason("")
{}
int playerID;
// 'kick', 'kill', 'ban', 'set', 'reset', or custom value from a plug-in
bz_ApiString pollAction;
// If it's a 'kick', 'kill' or 'ban', this will be the victim's callsign
// If it's a 'set', this will be e.g. '_mirror black'
// If it's a 'reset', this will be 'flags'
bz_ApiString pollTarget;
bool allow;
bz_ApiString reason;
};
class BZF_API bz_PollStartEventData_V1 : public bz_EventData
{
public:
bz_PollStartEventData_V1() : bz_EventData(bz_ePollStartEvent),
playerID(BZ_SERVER), pollAction(""), pollTarget("")
{}
int playerID;
// See bz_AllowPollEventData_V1 for notes
bz_ApiString pollAction;
bz_ApiString pollTarget;
};
class BZF_API bz_PollVoteEventData_V1 : public bz_EventData
{
public:
bz_PollVoteEventData_V1() : bz_EventData(bz_ePollVoteEvent),
playerID(BZ_SERVER), inFavor(false), allow(true), reason("")
{}
int playerID;
bool inFavor;
bool allow;
bz_ApiString reason;
};
class BZF_API bz_PollVetoEventData_V1 : public bz_EventData
{
public:
bz_PollVetoEventData_V1() : bz_EventData(bz_ePollVetoEvent),
playerID(BZ_SERVER)
{}
int playerID;
};
class BZF_API bz_PollEndEventData_V1 : public bz_EventData
{
public:
bz_PollEndEventData_V1() : bz_EventData(bz_ePollEndEvent),
successful(false), yesCount(0), noCount(0), abstentionCount(0)
{}
bool successful;
int yesCount;
int noCount;
int abstentionCount;
};
class BZF_API bz_PlayerAuthEventData_V1 : public bz_EventData
{
public:
bz_PlayerAuthEventData_V1() : bz_EventData(bz_ePlayerAuthEvent)
, playerID(-1), password(false), globalAuth(false)
{
}