home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / bzflag-2.0.4.exe / API / bzfsAPI.h < prev   
Encoding:
C/C++ Source or Header  |  2005-09-28  |  23.4 KB  |  1,018 lines

  1. /* bzflag
  2. * Copyright (c) 1993 - 2005 Tim Riker
  3. *
  4. * This package is free software;  you can redistribute it and/or
  5. * modify it under the terms of the license found in the file
  6. * named COPYING that should have accompanied this file.
  7. *
  8. * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  9. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  10. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  11. */
  12.  
  13. // all the exported functions for bzfs plugins
  14.  
  15. #ifndef _BZFS_API_H_
  16. #define _BZFS_API_H_
  17.  
  18. /* system interface headers */
  19. #include <string>
  20. #include <vector>
  21.  
  22.  
  23. #ifdef _WIN32
  24.     #ifdef INSIDE_BZ
  25.         #define BZF_API __declspec( dllexport )
  26.     #else
  27.         #define BZF_API __declspec( dllimport )
  28.     #endif
  29.     #define BZF_PLUGIN_CALL
  30. #else
  31.     #define BZF_API
  32.     #define BZF_PLUGIN_CALL extern "C"
  33. #endif
  34.  
  35. #define BZ_API_VERSION    13
  36.  
  37. #define BZ_GET_PLUGIN_VERSION BZF_PLUGIN_CALL int bz_GetVersion ( void ) { return BZ_API_VERSION;}
  38.  
  39. // versioning
  40. BZF_API int bz_APIVersion ( void );
  41.  
  42. // event stuff
  43.  
  44. typedef enum
  45. {
  46.     bz_eNullEvent = 0,
  47.     bz_eCaptureEvent,
  48.     bz_ePlayerDieEvent,
  49.     bz_ePlayerSpawnEvent,
  50.     bz_eZoneEntryEvent,
  51.     bz_eZoneExitEvent,
  52.     bz_ePlayerJoinEvent,
  53.     bz_ePlayerPartEvent,
  54.     bz_eChatMessageEvent,
  55.     bz_eUnknownSlashCommand,
  56.     bz_eGetPlayerSpawnPosEvent,
  57.     bz_eGetAutoTeamEvent,
  58.     bz_eAllowPlayer,
  59.     bz_eTickEvent,
  60.     bz_eGenerateWorldEvent,
  61.     bz_eGetPlayerInfoEvent,
  62.     bz_eAllowSpawn,
  63.     bz_eListServerUpdateEvent,
  64.     bz_eBanEvent,
  65.     bz_eHostBanEvent,
  66.     bz_eKickEvent,
  67.     bz_eKillEvent,
  68.     bz_ePlayerPausedEvent,
  69.     bz_eLastEvent    //this is never used as an event, just show it's the last one
  70. }bz_eEventType;
  71.  
  72. // permision #defines
  73. #define bz_perm_actionMessage  "actionMessage"
  74. #define bz_perm_adminMessageReceive  "adminMessageReceive"
  75. #define bz_perm_adminMessageSend  "adminMessageSend"
  76. #define bz_perm_antiban   "antiban"
  77. #define bz_perm_antideregister   "antideregister"
  78. #define bz_perm_antikick   "antikick"
  79. #define bz_perm_antikill   "antikill"
  80. #define bz_perm_antipoll   "antipoll"
  81. #define bz_perm_antipollban   "antipollban"
  82. #define bz_perm_antipollkick   "antipollkick"
  83. #define bz_perm_antipollkill   "antipollkill"
  84. #define bz_perm_ban  "ban"
  85. #define bz_perm_banlist  "banlist"
  86. #define bz_perm_countdown  "countdown"
  87. #define bz_perm_date  "date"
  88. #define bz_perm_endGame  "endGame"
  89. #define bz_perm_flagHistory  "flagHistory"
  90. #define bz_perm_flagMod  "flagMod"
  91. #define bz_perm_hideAdmin  "hideAdmin"
  92. #define bz_perm_idleStats  "idleStats"
  93. #define bz_perm_info  "info"
  94. #define bz_perm_kick  "kick"
  95. #define bz_perm_kill  "kill"
  96. #define bz_perm_lagStats  "lagStats"
  97. #define bz_perm_lagwarn  "lagwarn"
  98. #define bz_perm_listPerms  "listPerms"
  99. #define bz_perm_masterBan  "masterban"
  100. #define bz_perm_mute  "mute"
  101. #define bz_perm_playerList  "playerList"
  102. #define bz_perm_poll  "poll"
  103. #define bz_perm_pollBan  "pollBan"
  104. #define bz_perm_pollKick  "pollKick"
  105. #define bz_perm_pollKill  "pollKill"
  106. #define bz_perm_pollSet  "pollSet"
  107. #define bz_perm_pollFlagReset  "pollFlagReset"
  108. #define bz_perm_privateMessage  "privateMessage"
  109. #define bz_perm_record  "record"
  110. #define bz_perm_rejoin  "rejoin"
  111. #define bz_perm_removePerms  "removePerms"
  112. #define bz_perm_replay  "replay"
  113. #define bz_perm_requireIdentify  "requireIdentify"
  114. #define bz_perm_say  "say"
  115. #define bz_perm_sendHelp  "sendHelp"
  116. #define bz_perm_setAll  "setAll"
  117. #define bz_perm_setPassword  "setPassword"
  118. #define bz_perm_setPerms  "setPerms"
  119. #define bz_perm_setVar  "setVar"
  120. #define bz_perm_showOthers  "showOthers"
  121. #define bz_perm_shortBan  "shortBan"
  122. #define bz_perm_shutdownServer  "shutdownServer"
  123. #define bz_perm_spawn  "spawn"
  124. #define bz_perm_superKill  "superKill"
  125. #define bz_perm_talk  "talk"
  126. #define bz_perm_unban  "unban"
  127. #define bz_perm_unmute  "unmute"
  128. #define bz_perm_veto  "veto"
  129. #define bz_perm_viewReports  "viewReports"
  130. #define bz_perm_vote  "vote"
  131.  
  132.  
  133. typedef enum
  134. {
  135.     eNoTeam = -1,
  136.     eRogueTeam = 0,
  137.     eRedTeam,
  138.     eGreenTeam,
  139.     eBlueTeam,
  140.     ePurpleTeam,
  141.     eRabbitTeam,
  142.     eHunterTeam,
  143.     eObservers,
  144.     eAdministrators
  145. }bz_eTeamType;
  146.  
  147. #define BZ_SERVER        -2
  148. #define BZ_ALLUSERS        -1
  149. #define BZ_NULLUSER        -3
  150.  
  151. #define BZ_BZDBPERM_NA        0
  152. #define BZ_BZDBPERM_USER    1
  153. #define BZ_BZDBPERM_SERVER    2
  154. #define BZ_BZDBPERM_CLIENT    3
  155.  
  156. //utility classes
  157. class BZF_API bzApiString
  158. {
  159. public:
  160.     bzApiString();
  161.     bzApiString(const char* c);
  162.     bzApiString(const std::string &s);
  163.     bzApiString(const bzApiString &r);
  164.  
  165.     ~bzApiString();
  166.  
  167.     bzApiString& operator = ( const bzApiString& r );
  168.     bzApiString& operator = ( const std::string& r );
  169.     bzApiString& operator = ( const char* r );
  170.  
  171.     bool operator == ( const bzApiString&r );
  172.     bool operator == ( const std::string& r );
  173.     bool operator == ( const char* r );
  174.  
  175.     bool operator != ( const bzApiString&r );
  176.     bool operator != ( const std::string& r );
  177.     bool operator != ( const char* r );
  178.  
  179.     unsigned int size ( void ) const;
  180.  
  181.     const char* c_str(void) const;
  182.  
  183.     void format(const char* fmt, ...);
  184.  
  185.     void replaceAll ( const char* target, const char* with );
  186.  
  187.     void tolower ( void );
  188.     void toupper ( void );
  189.  
  190. protected:
  191.     class dataBlob;
  192.  
  193.     dataBlob    *data;
  194. };
  195.  
  196.  class BZF_API bzAPIIntList
  197.  {
  198.  public:
  199.      bzAPIIntList();
  200.      bzAPIIntList(const bzAPIIntList    &r);
  201.      bzAPIIntList(const std::vector<int>    &r);
  202.  
  203.      ~bzAPIIntList();
  204.  
  205.      void push_back ( int value );
  206.      int get ( unsigned int i );
  207.  
  208.      const int& operator[] (unsigned int i) const;
  209.      bzAPIIntList& operator = ( const bzAPIIntList& r );
  210.      bzAPIIntList& operator = ( const std::vector<int>& r );
  211.  
  212.      unsigned int size ( void );
  213.      void clear ( void );
  214.  
  215.  protected:
  216.      class dataBlob;
  217.  
  218.      dataBlob *data;
  219.  };
  220.  
  221.  BZF_API bzAPIIntList* bz_newIntList ( void );
  222.  BZF_API void bz_deleteIntList( bzAPIIntList * l );
  223.  
  224.  class BZF_API bzAPIFloatList
  225.  {
  226.  public:
  227.      bzAPIFloatList();
  228.      bzAPIFloatList(const bzAPIFloatList    &r);
  229.      bzAPIFloatList(const std::vector<float>    &r);
  230.  
  231.      ~bzAPIFloatList();
  232.  
  233.      void push_back ( float value );
  234.      float get ( unsigned int i );
  235.  
  236.      const float& operator[] (unsigned int i) const;
  237.      bzAPIFloatList& operator = ( const bzAPIFloatList& r );
  238.      bzAPIFloatList& operator = ( const std::vector<float>& r );
  239.  
  240.      unsigned int size ( void );
  241.      void clear ( void );
  242.  
  243.  protected:
  244.      class dataBlob;
  245.  
  246.      dataBlob *data;
  247.  };
  248.  
  249.  BZF_API bzAPIFloatList* bz_newFloatList ( void );
  250.  BZF_API void bz_deleteFloatList( bzAPIFloatList * l );
  251.  
  252.  class BZF_API bzAPIStringList
  253.  {
  254.  public:
  255.      bzAPIStringList();
  256.      bzAPIStringList(const bzAPIStringList    &r);
  257.      bzAPIStringList(const std::vector<std::string>    &r);
  258.  
  259.      ~bzAPIStringList();
  260.  
  261.      void push_back ( const bzApiString &value );
  262.      void push_back ( const std::string &value );
  263.      bzApiString get ( unsigned int i );
  264.  
  265.      const bzApiString& operator[] (unsigned int i) const;
  266.      bzAPIStringList& operator = ( const bzAPIStringList& r );
  267.      bzAPIStringList& operator = ( const std::vector<std::string>& r );
  268.  
  269.      unsigned int size ( void );
  270.      void clear ( void );
  271.  
  272.      void tokenize ( const char* in, const char* delims, int maxTokens = 0, bool useQuotes = false);
  273.  protected:
  274.      class dataBlob;
  275.  
  276.      dataBlob *data;
  277.  };
  278.  
  279.  BZF_API bzAPIStringList* bz_newStringList ( void );
  280.  BZF_API void bz_deleteStringList( bzAPIStringList * l );
  281.  
  282. // event data types
  283. class bz_EventData
  284. {
  285. public:
  286.     bz_EventData(){eventType = bz_eNullEvent;}
  287.     virtual ~bz_EventData(){};
  288.  
  289.     bz_eEventType    eventType;
  290. };
  291.  
  292. class bz_CTFCaptureEventData : public bz_EventData
  293. {
  294. public:
  295.     bz_CTFCaptureEventData()
  296.     {
  297.         eventType = bz_eCaptureEvent;
  298.         teamCapped = eNoTeam;
  299.         teamCapping = eNoTeam;
  300.         playerCapping = -1;
  301.     }
  302.     virtual ~bz_CTFCaptureEventData(){};
  303.  
  304.     bz_eTeamType teamCapped;
  305.     bz_eTeamType teamCapping;
  306.     int playerCapping;
  307.  
  308.     float pos[3];
  309.     float rot;
  310.     double time;
  311. };
  312.  
  313. class bz_PlayerDieEventData : public bz_EventData
  314. {
  315. public:
  316.     bz_PlayerDieEventData()
  317.     {
  318.         eventType = bz_ePlayerDieEvent;
  319.         playerID = -1;
  320.         team = eNoTeam;
  321.         killerID = -1;
  322.         killerTeam = eNoTeam;
  323.  
  324.         pos[0] = pos[1] = pos[2] = 0.0f;
  325.         rot = 0.0f;
  326.         time = 0.0;
  327.     }
  328.     virtual ~bz_PlayerDieEventData(){};
  329.  
  330.     int playerID;
  331.     bz_eTeamType team;
  332.     int killerID;
  333.     bz_eTeamType killerTeam;
  334.     bzApiString flagKilledWith;
  335.  
  336.     float pos[3];
  337.     float rot;
  338.     double time;
  339. };
  340.  
  341. class bz_PlayerSpawnEventData : public bz_EventData
  342. {
  343. public:
  344.     bz_PlayerSpawnEventData()
  345.     {
  346.         eventType = bz_ePlayerSpawnEvent;
  347.         playerID = -1;
  348.         team = eNoTeam;
  349.  
  350.         pos[0] = pos[1] = pos[2] = 0.0f;
  351.         rot = 0.0f;
  352.         time = 0.0;
  353.     }
  354.  
  355.     virtual ~bz_PlayerSpawnEventData(){};
  356.  
  357.     int playerID;
  358.     bz_eTeamType team;
  359.  
  360.     float pos[3];
  361.     float rot;
  362.     double time;
  363. };
  364.  
  365. class bz_ChatEventData : public bz_EventData
  366. {
  367. public:
  368.     bz_ChatEventData()
  369.     {
  370.         eventType = bz_eChatMessageEvent;
  371.  
  372.         from = -1;
  373.         to = -1;
  374.         time = 0.0;
  375.         team = eNoTeam;
  376.     }
  377.  
  378.     virtual ~bz_ChatEventData(){};
  379.  
  380.     int from;
  381.     int to;
  382.     bz_eTeamType    team;
  383.     bzApiString message;
  384.  
  385.     double time;
  386. };
  387.  
  388. class bz_PlayerJoinPartEventData : public bz_EventData
  389. {
  390. public:
  391.     bz_PlayerJoinPartEventData()
  392.     {
  393.         eventType = bz_ePlayerJoinEvent;
  394.  
  395.         playerID = -1;
  396.         team = eNoTeam;
  397.         time = 0.0;
  398.     }
  399.     virtual ~bz_PlayerJoinPartEventData(){};
  400.  
  401.     int playerID;
  402.     bz_eTeamType team;
  403.  
  404.     bzApiString callsign;
  405.     bzApiString reason;
  406.  
  407.     double time;
  408. };
  409.  
  410. class bz_UnknownSlashCommandEventData : public bz_EventData
  411. {
  412. public:
  413.     bz_UnknownSlashCommandEventData()
  414.     {
  415.         eventType = bz_eUnknownSlashCommand;
  416.         from = -1;
  417.         handled = false;
  418.         time = 0;
  419.     }
  420.  
  421.     virtual ~bz_UnknownSlashCommandEventData(){};
  422.  
  423.     int from;
  424.  
  425.     bool handled;
  426.     bzApiString message;
  427.  
  428.     double time;
  429. };
  430.  
  431. class  bz_GetPlayerSpawnPosEventData : public bz_EventData
  432. {
  433. public:
  434.     bz_GetPlayerSpawnPosEventData()
  435.     {
  436.         eventType = bz_eGetPlayerSpawnPosEvent;
  437.         playerID = -1;
  438.         team = eNoTeam;
  439.  
  440.         handled = false;
  441.  
  442.         pos[0] = pos[1] = pos[2] = 0.0f;
  443.         rot = 0.0f;
  444.         time = 0.0;
  445.     }
  446.  
  447.     virtual ~bz_GetPlayerSpawnPosEventData(){};
  448.  
  449.     int playerID;
  450.     bz_eTeamType team;
  451.  
  452.     bool handled;
  453.  
  454.     float pos[3];
  455.     float rot;
  456.     double time;
  457. };
  458.  
  459. class bz_AllowPlayerEventData : public bz_EventData
  460. {
  461. public:
  462.     bz_AllowPlayerEventData()
  463.     {
  464.         eventType = bz_eAllowPlayer;
  465.         playerID = -1;
  466.         allow = true;
  467.         time = 0.0;
  468.     }
  469.  
  470.     virtual ~bz_AllowPlayerEventData(){};
  471.  
  472.     int playerID;
  473.     bzApiString callsign;
  474.     bzApiString ipAddress;
  475.  
  476.     bzApiString reason;
  477.  
  478.     bool allow;
  479.  
  480.     double time;
  481. };
  482.  
  483. class bz_TickEventData : public bz_EventData
  484. {
  485. public:
  486.     bz_TickEventData()
  487.     {
  488.         eventType = bz_eTickEvent;
  489.         time = 0.0;
  490.     }
  491.     virtual ~bz_TickEventData(){};
  492.  
  493.     double time;
  494. };
  495.  
  496. class bz_GenerateWorldEventData : public bz_EventData
  497. {
  498. public:
  499.     bz_GenerateWorldEventData()
  500.     {
  501.         eventType = bz_eGenerateWorldEvent;
  502.         handled = false;
  503.         ctf = false;
  504.         time = 0.0;
  505.     }
  506.     virtual ~bz_GenerateWorldEventData(){};
  507.  
  508.     bool handled;
  509.     bool ctf;
  510.  
  511.     double time;
  512. };
  513.  
  514. class bz_GetPlayerInfoEventData : public bz_EventData
  515. {
  516. public:
  517.     bz_GetPlayerInfoEventData()
  518.     {
  519.         eventType = bz_eGetPlayerInfoEvent;
  520.         playerID = -1;
  521.         team = eNoTeam;
  522.         admin = false;
  523.         verified = false;
  524.         registered = false;
  525.         time = 0.0;
  526.     }
  527.     virtual ~bz_GetPlayerInfoEventData(){};
  528.  
  529.     int playerID;
  530.     bzApiString callsign;
  531.     bzApiString ipAddress;
  532.  
  533.     bz_eTeamType team;
  534.  
  535.     bool admin;
  536.     bool verified;
  537.     bool registered;
  538.     double time;
  539. };
  540.  
  541. class bz_GetAutoTeamEventData : public bz_EventData
  542. {
  543. public:
  544.     bz_GetAutoTeamEventData()
  545.     {
  546.         playeID = -1;
  547.         team = eNoTeam;
  548.         handled = false;
  549.     }
  550.  
  551.     virtual ~bz_GetAutoTeamEventData(){};
  552.  
  553.     int playeID;
  554.     bzApiString callsign;
  555.     bz_eTeamType team;
  556.  
  557.     bool handled;
  558. };
  559.  
  560. class  bz_AllowSpawnData : public bz_EventData
  561. {
  562. public:
  563.     bz_AllowSpawnData()
  564.     {
  565.         eventType = bz_eAllowSpawn;
  566.         playerID = -1;
  567.         team = eNoTeam;
  568.  
  569.         handled = false;
  570.         allow = true;
  571.  
  572.         time = 0.0;
  573.     }
  574.  
  575.     virtual ~bz_AllowSpawnData(){};
  576.  
  577.     int playerID;
  578.     bz_eTeamType team;
  579.  
  580.     bool handled;
  581.     bool allow;
  582.     double time;
  583. };
  584.  
  585. class  bz_ListServerUpdateEvent : public bz_EventData
  586. {
  587. public:
  588.     bz_ListServerUpdateEvent()
  589.     {
  590.         eventType = bz_eListServerUpdateEvent;
  591.         handled = false;
  592.         time = 0.0;
  593.     }
  594.  
  595.     virtual ~bz_ListServerUpdateEvent(){};
  596.  
  597.     bzApiString        address;
  598.     bzApiString        description;
  599.     bzApiString        groups;
  600.  
  601.     bool handled;
  602.     double time;
  603. };
  604.  
  605. class bz_BanEventData : public bz_EventData
  606. {
  607. public:
  608.     bz_BanEventData()
  609.     {
  610.         eventType = bz_eBanEvent;
  611.         bannerID = -1;
  612.         banneeID = -1;
  613.         duration = -1;
  614.     }
  615.     virtual ~bz_BanEventData(){};
  616.  
  617.     int bannerID;
  618.     int banneeID;
  619.     int duration;
  620.     bzApiString ipAddress;
  621.     bzApiString reason;
  622. };
  623.  
  624. class bz_HostBanEventData : public bz_EventData
  625. {
  626. public:
  627.     bz_HostBanEventData()
  628.     {
  629.         eventType = bz_eHostBanEvent;
  630.         bannerID = -1;
  631.         duration = -1;
  632.     }
  633.     virtual ~bz_HostBanEventData(){};
  634.  
  635.     int bannerID;
  636.     int duration;
  637.     bzApiString hostPattern;
  638.     bzApiString reason;
  639. };
  640.  
  641. class bz_KickEventData : public bz_EventData
  642. {
  643. public:
  644.     bz_KickEventData()
  645.     {
  646.         eventType = bz_eKickEvent;
  647.         kickerID = -1;
  648.         kickedID = -1;
  649.     }
  650.     virtual ~bz_KickEventData(){};
  651.  
  652.     int kickerID;
  653.     int kickedID;
  654.     bzApiString reason;
  655. };
  656.  
  657. class bz_KillEventData : public bz_EventData
  658. {
  659. public:
  660.     bz_KillEventData()
  661.     {
  662.         eventType = bz_eKillEvent;
  663.         killerID = -1;
  664.         killedID = -1;
  665.     }
  666.     virtual ~bz_KillEventData(){};
  667.  
  668.     int killerID;
  669.     int killedID;
  670.     bzApiString reason;
  671. };
  672.  
  673. class bz_PlayerPausedEventData : public bz_EventData
  674. {
  675. public:
  676.     bz_PlayerPausedEventData()
  677.     {
  678.         eventType = bz_ePlayerPausedEvent;
  679.     }
  680.     virtual ~bz_PlayerPausedEventData(){};
  681.  
  682.     int player;
  683.     double time;
  684. };
  685.  
  686. // event handler callback
  687. class bz_EventHandler
  688. {
  689. public:
  690.     virtual ~bz_EventHandler(){};
  691.     virtual void process ( bz_EventData *eventData ) = 0;
  692.     virtual bool autoDelete ( void ) { return false; }    // only set this to true if you are internal to the bzfs module ( on windows )
  693. };
  694.  
  695. BZF_API bool bz_registerEvent ( bz_eEventType eventType, bz_EventHandler* eventHandler );
  696. BZF_API bool bz_removeEvent ( bz_eEventType eventType, bz_EventHandler* eventHandler );
  697.  
  698. // player info
  699.  
  700. class bz_PlayerRecord;
  701.  
  702. BZF_API bool bz_getPlayerIndexList ( bzAPIIntList *playerList );
  703. BZF_API bz_PlayerRecord *bz_getPlayerByIndex ( int index );
  704. BZF_API bool bz_updatePlayerData ( bz_PlayerRecord *playerRecord );
  705. BZF_API bool bz_hasPerm ( int playerID, const char* perm );
  706. BZF_API bool bz_grantPerm ( int playerID, const char* perm );
  707. BZF_API bool bz_revokePerm ( int playerID, const char* perm );
  708. BZF_API bool bz_freePlayerRecord ( bz_PlayerRecord *playerRecord );
  709.  
  710. class bz_PlayerRecord
  711. {
  712. public:
  713.     bz_PlayerRecord()
  714.     {
  715.         playerID = -1;
  716.         team = eNoTeam;
  717.  
  718.         pos[0] = pos[1] = pos[2] = 0;
  719.         rot = 0;
  720.  
  721.         spawned = false;
  722.         verified = false;
  723.         globalUser = false;
  724.         admin = false;
  725.  
  726.         wins = 0;
  727.         losses = 0;
  728.     }
  729.  
  730.     ~bz_PlayerRecord(){};
  731.  
  732.     void update ( void ){bz_updatePlayerData(this);}    // call to update with current data
  733.  
  734.     bool hasPerm ( const char* perm ){return bz_hasPerm(playerID,perm);}
  735.     bool grantPerm ( const char* perm ){return bz_grantPerm(playerID,perm);}
  736.     bool revokePerm ( const char* perm ){return bz_revokePerm(playerID,perm);}
  737.  
  738.     int playerID;
  739.     bzApiString callsign;
  740.     bzApiString email;
  741.  
  742.     bz_eTeamType team;
  743.  
  744.     float pos[3];
  745.     float rot;
  746.  
  747.     bzApiString ipAddress;
  748.  
  749.     bzApiString currentFlag;
  750.     bzAPIStringList flagHistory;
  751.  
  752.     bool spawned;
  753.     bool verified;
  754.     bool globalUser;
  755.     bool admin;
  756.     bzAPIStringList groups;
  757.  
  758.     int wins;
  759.     int losses;
  760.     int teamKills;
  761. };
  762.  
  763. BZF_API bool bz_setPlayerAdmin (int playerId);
  764.  
  765. // groups API
  766. BZF_API bzAPIStringList* bz_getGroupList ( void );
  767. BZF_API bzAPIStringList* bz_getGroupPerms ( const char* group );
  768. BZF_API bool bz_groupAllowPerm ( const char* group, const char* perm );
  769.  
  770. // message API
  771. BZF_API bool bz_sendTextMessage (int from, int to, const char* message);
  772. BZF_API bool bz_sendTextMessage (int from, bz_eTeamType to, const char* message);
  773. BZF_API bool bz_sentFetchResMessage ( int playerID,  const char* URL );
  774.  
  775. // world weapons
  776. BZF_API bool bz_fireWorldWep ( const char* flagType, float lifetime, int fromPlayer, float *pos, float tilt, float direction, int shotID , float dt );
  777.  
  778. // time API
  779. BZF_API double bz_getCurrentTime ( void );
  780. BZF_API float bz_getMaxWaitTime ( void );
  781. BZF_API void bz_setMaxWaitTime ( float time );
  782.  
  783. typedef struct
  784. {
  785.     int year;
  786.     int month;
  787.     int day;
  788.     int hour;
  789.     int minute;
  790.     int second;
  791.     bool daylightSavings;
  792. }bz_localTime;
  793.  
  794. BZF_API void bz_getLocaltime ( bz_localTime    *ts );
  795.  
  796. // BZDB API
  797. BZF_API double bz_getBZDBDouble ( const char* variable );
  798. BZF_API bzApiString bz_getBZDBString( const char* variable );
  799. BZF_API bool bz_getBZDBBool( const char* variable );
  800. BZF_API int bz_getBZDBInt( const char* variable );
  801.  
  802. BZF_API int bz_getBZDBItemPerms( const char* variable );
  803. BZF_API bool bz_getBZDBItemPesistent( const char* variable );
  804. BZF_API bool bz_BZDBItemExists( const char* variable );
  805.  
  806. BZF_API bool bz_setBZDBDouble ( const char* variable, double val, int perms = 0, bool persistent = false );
  807. BZF_API bool bz_setBZDBString( const char* variable, const char *val, int perms = 0, bool persistent = false  );
  808. BZF_API bool bz_setBZDBBool( const char* variable, bool val, int perms = 0, bool persistent = false  );
  809. BZF_API bool bz_setBZDBInt( const char* variable, int val, int perms = 0, bool persistent = false  );
  810.  
  811. BZF_API int bz_getBZDBVarList( bzAPIStringList    *varList );
  812.  
  813.  
  814. // logging
  815. BZF_API void bz_debugMessage ( int debugLevel, const char* message );
  816. BZF_API int bz_getDebugLevel ( void );
  817.  
  818. // admin
  819. BZF_API bool bz_kickUser ( int playerIndex, const char* reason, bool notify );
  820. BZF_API bool bz_IPBanUser ( int playerIndex, const char* ip, int time, const char* reason );
  821.  
  822. // custom commands
  823.  
  824. class bz_CustomSlashCommandHandler
  825. {
  826. public:
  827.     virtual ~bz_CustomSlashCommandHandler(){};
  828.     virtual bool handle ( int playerID, bzApiString command, bzApiString message, bzAPIStringList *params ) = 0;
  829.  
  830. };
  831.  
  832. BZF_API bool bz_registerCustomSlashCommand ( const char* command, bz_CustomSlashCommandHandler *handler );
  833. BZF_API bool bz_removeCustomSlashCommand ( const char* command );
  834.  
  835. // spawning
  836. BZF_API bool bz_getStandardSpawn ( int playeID, float pos[3], float *rot );
  837.  
  838. // dying
  839. BZF_API bool bz_killPlayer ( int playeID, bool spawnOnBase, int killerID = -1, const char* flagID = NULL );
  840.  
  841. // flags
  842. BZF_API bool bz_removePlayerFlag ( int playeID );
  843. BZF_API void bz_resetFlags ( bool onlyUnused );
  844.  
  845. // world
  846. typedef struct
  847. {
  848.     bool    driveThru;
  849.     bool    shootThru;
  850. }bz_WorldObjectOptions;
  851.  
  852. typedef struct
  853. {
  854.     bzApiString        texture;
  855.     bool        useAlpha;
  856.     bool        useColorOnTexture;
  857.     bool        useSphereMap;
  858.     int            combineMode;
  859. }bz_MaterialTexture;
  860.  
  861. class BZF_API bzAPITextureList
  862. {
  863. public:
  864.     bzAPITextureList();
  865.     bzAPITextureList(const bzAPITextureList    &r);
  866.  
  867.     ~bzAPITextureList();
  868.  
  869.     void push_back ( bz_MaterialTexture &value );
  870.     bz_MaterialTexture get ( unsigned int i );
  871.  
  872.     const bz_MaterialTexture& operator[] (unsigned int i) const;
  873.     bzAPITextureList& operator = ( const bzAPITextureList& r );
  874.  
  875.     unsigned int size ( void );
  876.     void clear ( void );
  877.  
  878. protected:
  879.     class dataBlob;
  880.  
  881.     dataBlob *data;
  882. };
  883.  
  884. typedef struct bz_MaterialInfo
  885. {
  886.     bzApiString name;
  887.     bzAPITextureList textures;
  888.  
  889.     float        ambient[4];
  890.     float        diffuse[4];
  891.     float        specular[4];
  892.     float        emisive[4];
  893.     float        shine;
  894.  
  895.     float        alphaThresh;
  896.     bool        culling;
  897.     bool        sorting;
  898. }bz_MaterialInfo;
  899.  
  900. // have bz make you a new material
  901. bz_MaterialInfo* bz_anewMaterial ( void );
  902. // tell bz you are done with a material
  903. void bz_deleteMaterial ( bz_MaterialInfo *material );
  904.  
  905. BZF_API bool bz_addWorldBox ( float *pos, float rot, float* scale, bz_WorldObjectOptions options );
  906. BZF_API bool bz_addWorldPyramid ( float *pos, float rot, float* scale, bool fliped, bz_WorldObjectOptions options );
  907. BZF_API bool bz_addWorldBase( float *pos, float rot, float* scale, bz_eTeamType team, bz_WorldObjectOptions options );
  908. BZF_API bool bz_addWorldTeleporter ( float *pos, float rot, float* scale, float border, bz_WorldObjectOptions options );
  909. BZF_API bool bz_addWorldWaterLevel( float level, bz_MaterialInfo *material );
  910. BZF_API bool bz_addWorldWeapon( const char* flagType, float *pos, float rot, float tilt, float initDelay, bzAPIFloatList &delays );
  911.  
  912. BZF_API bool bz_setWorldSize( float size, float wallHeight = -1.0 );
  913.  
  914. // custom map objects
  915.  
  916. typedef struct bz_CustomMapObjectInfo
  917. {
  918.     bzApiString name;
  919.     bzAPIStringList data;
  920. }bz_CustomMapObjectInfo;
  921.  
  922. class bz_CustomMapObjectHandler
  923. {
  924. public:
  925.     virtual ~bz_CustomMapObjectHandler(){};
  926.     virtual bool handle ( bzApiString object, bz_CustomMapObjectInfo *data ) = 0;
  927.  
  928. };
  929.  
  930. BZF_API bool bz_registerCustomMapObject ( const char* object, bz_CustomMapObjectHandler *handler );
  931. BZF_API bool bz_removeCustomMapObject ( const char* object );
  932.  
  933.  
  934. // public server info
  935. BZF_API bool bz_getPublic( void );
  936. BZF_API bzApiString bz_getPublicAddr( void );
  937. BZF_API bzApiString bz_getPublicDescription( void );
  938.  
  939. // custom client sounds
  940. BZF_API bool bz_sendPlayCustomLocalSound ( int playerID, const char* soundName );
  941.  
  942. class bz_APIPluginHandler
  943. {
  944. public:
  945.     virtual ~bz_APIPluginHandler(){};
  946.     virtual bool handle ( bzApiString plugin, bzApiString param ) = 0;
  947. };
  948. // custom pluginHandler
  949. BZF_API bool bz_registerCustomPluginHandler ( const char* extension, bz_APIPluginHandler * handler );
  950. BZF_API bool bz_removeCustomPluginHandler ( const char* extension, bz_APIPluginHandler * handler );
  951.  
  952. // team info
  953. BZF_API int bz_getTeamCount (bz_eTeamType team );
  954. BZF_API int bz_getTeamScore (bz_eTeamType team );
  955. BZF_API int bz_getTeamWins (bz_eTeamType team );
  956. BZF_API int bz_getTeamLosses (bz_eTeamType team );
  957.  
  958. BZF_API void bz_setTeamWins (bz_eTeamType team, int wins );
  959. BZF_API void bz_setTeamLosses (bz_eTeamType team, int losses );
  960.  
  961. BZF_API void bz_resetTeamScore (bz_eTeamType team );
  962.  
  963. // list server
  964. BZF_API void bz_updateListServer ( void );
  965.  
  966. // url API
  967. class bz_URLHandler
  968. {
  969. public:
  970.     virtual ~bz_URLHandler(){};
  971.     virtual void done ( const char* URL, void * data, unsigned int size, bool complete ) = 0;
  972.     virtual void timeout ( const char* /*URL*/, int /*errorCode*/ ){};
  973.     virtual void error ( const char* /*URL*/, int /*errorCode*/, const char * /*errorString*/ ){};
  974. };
  975.  
  976. BZF_API bool bz_addURLJob ( const char* URL, bz_URLHandler* handler = NULL, const char* postData = NULL );
  977. BZF_API bool bz_removeURLJob ( const char* URL );
  978. BZF_API bool bz_stopAllURLJobs ( void );
  979.  
  980. // inter plugin communication
  981. BZF_API bool bz_clipFieldExists ( const char *name );
  982. BZF_API const char* bz_getclipFieldString ( const char *name );
  983. BZF_API float bz_getclipFieldFloat ( const char *name );
  984. BZF_API int bz_getclipFieldInt( const char *name );
  985.  
  986. BZF_API bool bz_setclipFieldString ( const char *name, const char* data );
  987. BZF_API bool bz_setclipFieldFloat ( const char *name, float data );
  988. BZF_API bool bz_setclipFieldInt( const char *name, int data );
  989.  
  990. // path checks
  991. BZF_API bzApiString bz_filterPath ( const char* path );
  992.  
  993. // Record-Replay
  994. BZF_API bool bz_saveRecBuf( const char * _filename, int seconds);
  995.  
  996. // cheap Text Utils
  997. BZF_API const char *bz_format(const char* fmt, ...);
  998. BZF_API const char *bz_toupper(const char* val );
  999. BZF_API const char *bz_tolower(const char* val );
  1000.  
  1001. // server control
  1002. BZF_API void bz_shutdown();
  1003. BZF_API void bz_superkill();
  1004. BZF_API void bz_gameOver(int,int = -1);
  1005.  
  1006. // info about the world
  1007. BZF_API bz_eTeamType bz_checkBaseAtPoint ( float pos[3] );
  1008.  
  1009. #endif //_BZFS_API_H_
  1010.  
  1011. // Local Variables: ***
  1012. // mode:C++ ***
  1013. // tab-width: 8 ***
  1014. // c-basic-offset: 2 ***
  1015. // indent-tabs-mode: t ***
  1016. // End: ***
  1017. // ex: shiftwidth=2 tabstop=8
  1018.