Exemplo n.º 1
0
void leagueOverSeer::loadConfig(const char* cmdLine) //Load the plugin configuration file
{
    PluginConfig config = PluginConfig(cmdLine);
    std::string section = "leagueOverSeer";

    if (config.errors) bz_shutdown(); //Shutdown the server

    //Extract all the data in the configuration file and assign it to plugin variables
    rotLeague = toBool(config.item(section, "ROTATIONAL_LEAGUE"));
    mapchangePath = config.item(section, "MAPCHANGE_PATH");
    SQLiteDB = config.item(section, "SQLITE_DB");
    LEAGUE_URL = config.item(section, "LEAGUE_OVER_SEER_URL");
    DEBUG = atoi((config.item(section, "DEBUG_LEVEL")).c_str());

    //Check for errors in the configuration data. If there is an error, shut down the server
    if (strcmp(LEAGUE_URL.c_str(), "") == 0)
    {
            bz_debugMessage(0, "*** DEBUG :: League Over Seer :: No URLs were choosen to report matches or query teams. ***");
            bz_shutdown();
    }
    if (DEBUG > 4 || DEBUG < 0)
    {
        bz_debugMessage(0, "*** DEBUG :: League Over Seer :: Invalid debug level in the configuration file. ***");
        bz_shutdown();
    }
}
Exemplo n.º 2
0
BZF_PLUGIN_CALL int bz_Load(const char* /*commandLine*/)
{
  registered = bz_callbackExists("RegisterHTTPDVDir");

  if (!registered) {
    if(server)
      delete(server);
    server = new HTTPServer;

    srand((unsigned int)bz_getCurrentTime());

    bz_registerCallBack("RegisterHTTPDVDir",&RegisterVDir);
    bz_registerCallBack("RemoveHTTPDVDir",&RemoveVDir);

    bz_registerEvent (bz_eTickEvent,server);
    bz_registerEvent (bz_eNewNonPlayerConnection,server);

    serverVersion = bz_getServerVersion();

    registered = true;
    bz_debugMessage(4,"HTTPServer plug-in loaded");
  } else {
    bz_debugMessage(1,"HTTPServer *WARNING* plug-in loaded more then once, this instance will not be used");
  }

  return 0;
}
Exemplo n.º 3
0
void LogDetail::listPlayers( action act , bz_PlayerJoinPartEventData_V1 *data )
{
  bz_APIIntList *playerList = bz_newIntList();
  bz_BasePlayerRecord *player = NULL;
  std::ostringstream msg;
  char playerStatus;
  int numPlayers;

  bz_getPlayerIndexList( playerList );

  bz_debugMessage( 4 , "Players:" );
  //
  // Count number of players
  //
  numPlayers = 0;
  for ( unsigned int i = 0; i < playerList->size(); i++ ) {
    player = bz_getPlayerByIndex( playerList->get(i));
    if (player) {
      if ((player->callsign != "") && (act == join || act == auth || (data && (player->playerID != data->playerID))))
	numPlayers++;
      bz_freePlayerRecord( player );
    }
  }

  //
  // Display number of players, callsign, and motto string in the following format:
  //
  // PLAYERS (nn) [G]cc:callsign(ee:mottostring)
  // nn - number of players
  // G	- global auth identifier (+|-| |@)
  // cc - count of characters in player callsign
  // callsign - player callsign
  // ee - count of characters in motto string
  // mottostring - player motto string
  //
  // eg.
  // PLAYERS (2) [@]7:Thumper(16:[email protected]) [ ]3:xxx()
  //
  msg.str("");
  msg << "PLAYERS (" << numPlayers << ")";
  for ( unsigned int i = 0; i < playerList->size(); i++ ) {
    player = bz_getPlayerByIndex( playerList->get(i));
    if (player) {
      if ((player->callsign != "") && (act == join || act == auth || (data && (player->playerID != data->playerID)))) {
	playerStatus = ' ';
	if (player->globalUser) playerStatus = '+';
	if (player->verified) playerStatus = '+';
	if (player->admin && !bz_hasPerm(player->playerID, bz_perm_hideAdmin)) playerStatus = '@';
	msg << " [" << playerStatus << "]";
	msg << player->callsign.size() << ':';
	msg << player->callsign.c_str() << "(" << bz_getPlayerMotto(player->playerID) << ")";
      }
    }
  }
  bz_debugMessage(0, msg.str().c_str());

  bz_deleteIntList(playerList);
}
Exemplo n.º 4
0
void autoFlagReset::Init (const char* commandLine)
{
    std::string cl = commandLine;

    if (nextRunTime < 0.0)
        nextRunTime = 0.0;

    if (cl.length() > 0)
    {
        if (cl.at(cl.length() - 1) == 'i' || cl.at(cl.length() - 1) == 'I')
        {
            // Incremental mode.
            incremental = true;

            cl = cl.substr(0, cl.length() - 1);
        }

        double newfreq = atof(cl.c_str());
        if (newfreq > 0.0)
            freq = newfreq * 60.0;

    }

    Register(bz_eTickEvent);

    bz_debugMessage(4,"autoFlagReset plugin loaded");
}
Exemplo n.º 5
0
void PlayerHandler::added(int playerIndex)
{
  bz_debugMessage(3, "PlayerHandler::added");
  std::string name = format("Sample %d", playerIndex);
  setPlayerData(name.c_str(), NULL, "bot sample", eObservers);
  joinGame();
}
Exemplo n.º 6
0
void CustomFlagSample::Cleanup ( void )
{
  // unregister our events
  Flush();

  bz_debugMessage(4, "customflagsample plugin unloaded");
}
Exemplo n.º 7
0
void killmsg::Init ( const char* commandLine )
{
  bz_debugMessage(4,"killmsg plugin loaded");
  if(&commandLine[0]) triti=atoi(&commandLine[0]);
  Register(bz_ePlayerDieEvent);


}
Exemplo n.º 8
0
BZF_PLUGIN_CALL int bz_Load ( const char* /* commandLine */ )
{
  bz_debugMessage(4,"shockwaveDeath plugin loaded");

  bz_registerEvent(bz_ePlayerDieEvent,&swDeathHandler);

  return 0;
}
Exemplo n.º 9
0
void MapChanger::Cleanup ( void )
{
  Flush();
  bz_removeCustomSlashCommand ( "maprandom" );
  bz_removeCustomSlashCommand ( "maplist" );
  bz_removeCustomSlashCommand ( "mapchange" );
  bz_debugMessage(4,"mapchange plugin unloaded");
}
Exemplo n.º 10
0
void fairCTF::Cleanup()
{

  Flush();
  bz_removeCustomSlashCommand ("ctf");

  bz_debugMessage(4,"fairCTF plugin unloaded");
}
Exemplo n.º 11
0
void CustomFlagSample::Event(bz_EventData *eventData)
{
  switch (eventData->eventType) {

  default: {
    // no, sir, we didn't ask for THIS!!
    bz_debugMessage(1, "customflagsample: received event with unrequested eventType!");
    return;
  }

  case bz_eFlagTransferredEvent: {
    bz_FlagTransferredEventData_V1* fte = (bz_FlagTransferredEventData_V1*)eventData;
    if (strcmp(fte->flagType, "CF") == 0)
	bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Custom Flag transferred!");
    break;
  }

  case bz_eFlagGrabbedEvent: {
    bz_FlagGrabbedEventData_V1* fge = (bz_FlagGrabbedEventData_V1*)eventData;
    if (strcmp(fge->flagType, "CF") == 0)
      bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Custom Flag grabbed!");
    break;
  }

  case bz_eFlagDroppedEvent: {
    bz_FlagDroppedEventData_V1* fde = (bz_FlagDroppedEventData_V1*)eventData;
    if (strcmp(fde->flagType, "CF") == 0)
      bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Custom Flag dropped!");
    break;
  }

  case bz_eShotFiredEvent: {
    bz_ShotFiredEventData_V1* sfed = (bz_ShotFiredEventData_V1*)eventData;
    int p = sfed->playerID;
    bz_BasePlayerRecord *playerRecord = bz_getPlayerByIndex(p);
    if (!playerRecord) break;
    if (playerRecord->currentFlag == "Custom Flag (+CF)")
    {
	bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "Shot fired by %s with Custom Flag!", playerRecord->callsign.c_str());
	// this user must be cool, add 10 to their score
	bz_BasePlayerRecord* player = bz_getPlayerByIndex(p);
	bz_setPlayerWins(p, player->wins+10);
    }
    break;
  }

  case bz_ePlayerDieEvent: {
    bz_PlayerDieEventData_V1* deed = (bz_PlayerDieEventData_V1*)eventData;
    bz_ApiString flag = deed->flagKilledWith;
    int p = deed->playerID;
    bz_BasePlayerRecord *playerRecord = bz_getPlayerByIndex(p);
    if (flag == "CF")
      bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "Player %s killed by a player with Custom Flag!", playerRecord->callsign.c_str());
    break;
  }

  }
}
Exemplo n.º 12
0
void flagResetTimerHandler::Cleanup(void)
{
    Flush();
    
    bz_removeCustomSlashCommand("flagresetunused");
    bz_removeCustomSlashCommand("frsetttime");
    bz_removeCustomSlashCommand("frcurrenttime");
    bz_debugMessage(4,"flagResetTimer plugin unloaded");
}
Exemplo n.º 13
0
void leagueOverSeer::doQuery(std::string query)
{
    /*
        Execute a SQL query without the need of any return values
    */

    bz_debugMessage(2, "DEBUG :: League Over Seer :: Executing following SQL query...");
    bz_debugMessagef(2, "DEBUG :: League Over Seer :: %s", query.c_str());

    char* db_err = 0; //a place to store the error
    sqlite3_exec(db, query.c_str(), NULL, 0, &db_err); //execute

    if (db_err != 0) //print out any errors
    {
        bz_debugMessage(2, "DEBUG :: League Over Seer :: SQL ERROR!");
        bz_debugMessagef(2, "DEBUG :: League Over Seer :: %s", db_err);
    }
}
Exemplo n.º 14
0
void SuperUser::Init ( const char* commandLine )
{
    if (commandLine == NULL || strlen(commandLine) == 0)
        bz_debugMessage(0,"SuperUser plugin needs a user file to work from");
    else
        Users.read(commandLine);

    Register(bz_eGetPlayerInfoEvent);
    Register(bz_ePlayerJoinEvent);
}
Exemplo n.º 15
0
void ServerSidePlayerSample::Init ( const char* /*commandLine*/ )
{
    bz_debugMessage(4,"serverSidePlayerSample plugin loaded");

    // bots need cycles
    MaxWaitTime = 0.01f;

    Register(bz_eTickEvent);
    Register(bz_eWorldFinalized);
}
Exemplo n.º 16
0
void NoRogueGenocide::Init ( const char* commandLine )
{
  bz_debugMessage(4,"NoRogueGenocide plugin loaded");

  std::string param = bz_tolower(commandLine);

  silentMode = (param == "silent" || param == "quiet");
  seamlessMode = (param == "seamless" || param == "hidden");

  Register(bz_eFlagGrabbedEvent);
  Register(bz_eShotFiredEvent);
}
Exemplo n.º 17
0
BZ_GET_PLUGIN_VERSION

BZF_PLUGIN_CALL int bz_Load ( const char* commandLine )
{
  if(!commandLine || !strlen(commandLine))
  {
    bz_debugMessage(0,"mapchange plugin requires a config file as a param and will not load");
    return -1;
  }

  if(!loadGamesFromFile(commandLine))
  {
    bz_debugMessage(0,"mapchange plugin config file failure, aborting load");
    return -1;
  }

  bz_debugMessage(4,"mapchange plugin loaded");

  if ( anyPlayers() )
    startTime = bz_getCurrentTime();

  bz_registerEvent ( bz_ePlayerJoinEvent, &handler );
  bz_registerEvent ( bz_ePlayerDieEvent, &handler );
  bz_registerEvent ( bz_ePlayerPartEvent, &handler );
  bz_registerEvent ( bz_eCaptureEvent, &handler );
  bz_registerEvent ( bz_eGetWorldEvent, &handler );
  bz_registerEvent ( bz_eTickEvent, &handler );
  bz_registerEvent ( bz_eListServerUpdateEvent, &handler );

  bz_registerCustomSlashCommand ( "mapnext",&slash );
  bz_registerCustomSlashCommand ( "mapreset",&slash );
  bz_registerCustomSlashCommand ( "mapcyclemode",&slash );
  bz_registerCustomSlashCommand ( "mapendmode",&slash );
  bz_registerCustomSlashCommand ( "maplist",&slash );
  bz_registerCustomSlashCommand ( "maplimit",&slash );

 return 0;
}
Exemplo n.º 18
0
void Defusal::Init(const char* /*commandLine*/)
{
    bz_debugMessage(4,"Defusal plugin loaded");
	
	bz_registerCustomSlashCommand("bomb", this);
	
	Register(bz_eFlagGrabbedEvent);
	Register(bz_eFlagDroppedEvent);
	Register(bz_ePlayerUpdateEvent);
	Register(bz_eTickEvent);
	
	bombPlaced = false;
	defusionInProgress = false;
}
Exemplo n.º 19
0
void CustomFlagSample::Init ( const char* /*commandLine*/ )
{
  bz_debugMessage(4, "customflagsample plugin loaded");

  // register our special custom flag
  bz_RegisterCustomFlag("CF", "Custom Flag", "A simple sample custom flag from the customflagsample plugin", /*eSuperShot*/0, eGoodFlag);

  // register events for pick up, drop, transfer, and fire
  Register(bz_eFlagTransferredEvent);
  Register(bz_eFlagGrabbedEvent);
  Register(bz_eFlagDroppedEvent);
  Register(bz_eShotFiredEvent);
  Register(bz_ePlayerDieEvent);
}
Exemplo n.º 20
0
void LogDetail::Init ( const char* /*commandLine*/ )
{
  Register(bz_eSlashCommandEvent);
  Register(bz_eRawChatMessageEvent);
  Register(bz_eServerMsgEvent);
  Register(bz_ePlayerJoinEvent);
  Register(bz_ePlayerPartEvent);
  Register(bz_ePlayerAuthEvent);
  Register(bz_eMessageFilteredEvent);

  bz_debugMessage(0, "SERVER-STATUS Running");
  bz_debugMessagef(0, "SERVER-MAPNAME %s", bz_getPublicDescription().c_str());
  listPlayers( join , NULL );
}
Exemplo n.º 21
0
void MapChanger::Init ( const char* commandLine )
{
  bz_debugMessage(4,"mapchange plugin loaded");
  PluginConfig config(commandLine);
  if(! config.errors) {
    confFile = config.item("mapchange", "ConfigurationFile");
    outputFile = config.item("mapchange", "OutputFile");
  }
  Register(bz_eGameEndEvent);
  Register(bz_eGameStartEvent);
  bz_registerCustomSlashCommand ( "mapchange", &mapChanger );
  bz_registerCustomSlashCommand ( "maplist", &mapChanger );
  bz_registerCustomSlashCommand ( "maprandom", &mapChanger );
  srand(time(NULL));
}
Exemplo n.º 22
0
BZF_PLUGIN_CALL int bz_Unload(void)
{
  if (registered) {
    bz_removeCallBack("RegisterHTTPDVDir",&RegisterVDir);
    bz_removeCallBack("RemoveHTTPDVDir",&RemoveVDir);

    bz_removeEvent (bz_eTickEvent,server);
    bz_removeEvent (bz_eNewNonPlayerConnection,server);
  }

  if(server)
    delete(server);

  server = NULL;
  bz_debugMessage(4,"HTTPServer plug-in unloaded");
  return 0;
}
Exemplo n.º 23
0
BZF_PLUGIN_CALL int bz_Unload(void)
{
  bz_debugMessage(4, "timedctf plugin unloaded");
  bz_removeEvent(bz_eCaptureEvent, &tctfflagcapped);
  bz_removeEvent(bz_ePlayerJoinEvent, &tctfplayerjoined);
  bz_removeEvent(bz_ePlayerUpdateEvent, &tctfplayerupdates);
  bz_removeEvent(bz_eTickEvent, &tctftickevents);
  bz_removeCustomSlashCommand("tctfstatus");
  bz_removeCustomSlashCommand("tctftime");
  bz_removeCustomSlashCommand("tctfon");
  bz_removeCustomSlashCommand("tctfoff");
  bz_removeCustomSlashCommand("fairctfon");
  bz_removeCustomSlashCommand("fairctfoff");
  bz_removeCustomSlashCommand("tctfsoundon");
  bz_removeCustomSlashCommand("tctfsoundoff");
  return 0;
}
Exemplo n.º 24
0
void flagResetTimerHandler::Init(const char* commandLine)
{
    bz_debugMessage(4,"flagResetTimer plugin loaded");
    Register(bz_eTickEvent);
    
    bz_registerCustomSlashCommand("flagresetunused", this);
    bz_registerCustomSlashCommand("frsettime", this);
    bz_registerCustomSlashCommand("frcurrenttime", this);
    
    if(&commandLine[0] != "" )
    {
        timeLimitMinutes=atoi(&commandLine[0]);
    }
    else
    {
        timeLimitMinutes=5;
    }
}
Exemplo n.º 25
0
BZF_PLUGIN_CALL int bz_Unload ( void )
{
  bz_removeEvent ( bz_ePlayerJoinEvent, &handler );
  bz_removeEvent ( bz_ePlayerDieEvent, &handler );
  bz_removeEvent ( bz_ePlayerPartEvent, &handler );
  bz_removeEvent ( bz_eCaptureEvent, &handler );
  bz_removeEvent ( bz_eGetWorldEvent, &handler );
  bz_removeEvent ( bz_eTickEvent, &handler );
  bz_removeEvent ( bz_eListServerUpdateEvent, &handler );

  bz_removeCustomSlashCommand ( "mapnext" );
  bz_removeCustomSlashCommand ( "mapreset" );
  bz_removeCustomSlashCommand ( "mapcyclemode" );
  bz_removeCustomSlashCommand ( "mapendmode" );
  bz_removeCustomSlashCommand ( "maplist" );
  bz_removeCustomSlashCommand ( "maplimit" );

  bz_debugMessage(4,"mapchange plugin unloaded");
  return 0;
}
Exemplo n.º 26
0
void observerChat::Init ( const char* commandLine )
{
  variableName = "_observerChat";
  defaultValue = "game";
  permName = "OBSERVERCHAT";

  int mode = (int)atoi(commandLine);
  const char* variableValue = "game";

  if (mode == 0 && commandLine != NULL && strlen(commandLine) != 0) variableValue = "off";
  else if (mode == 1) variableValue = "game";
  else if (mode == 2) variableValue = "alwaysOn";
  else if (bz_BZDBItemExists(variableName))
    variableValue = bz_getBZDBString(variableName).c_str();
  
  bz_setBZDBString(variableName, variableValue);

  bz_debugMessage(4,"observerChat plugin loaded");

  Register(bz_eRawChatMessageEvent);
}
Exemplo n.º 27
0
BZF_PLUGIN_CALL int bz_Load(const char * /*commandLine */ )
{
  bz_debugMessage(4, "koth plugin loaded");
  bz_registerCustomMapObject("KOTH", &kothmaphandler);
  bz_registerEvent(bz_ePlayerUpdateEvent, &kotheventhandler);
  bz_registerEvent(bz_ePlayerPausedEvent, &kothplayerpaused);
  bz_registerEvent(bz_ePlayerPartEvent, &kothplayerleft);
  bz_registerEvent(bz_ePlayerJoinEvent, &kothplayerjoined);
  bz_registerEvent(bz_ePlayerDieEvent, &kothplayerdied);
  bz_registerCustomSlashCommand("kothstatus", &kothcommands);
  bz_registerCustomSlashCommand("kothon", &kothcommands);
  bz_registerCustomSlashCommand("kothoff", &kothcommands);
  bz_registerCustomSlashCommand("kothsoundon", &kothcommands);
  bz_registerCustomSlashCommand("kothsoundoff", &kothcommands);
  bz_registerCustomSlashCommand("kothtimemult", &kothcommands);
  bz_registerCustomSlashCommand("kothtimemultmin", &kothcommands);
  bz_registerCustomSlashCommand("kothtime", &kothcommands);
  bz_registerCustomSlashCommand("kothautotimeon", &kothcommands);
  bz_registerCustomSlashCommand("kothautotimeoff", &kothcommands);
  bz_registerCustomSlashCommand("kingsay", &kothcommands);
  return 0;
}
Exemplo n.º 28
0
BZF_PLUGIN_CALL int bz_Unload(void)
{
  bz_removeEvent(bz_ePlayerUpdateEvent, &kotheventhandler);
  bz_removeEvent(bz_ePlayerPausedEvent, &kothplayerpaused);
  bz_removeEvent(bz_ePlayerPartEvent, &kothplayerleft);
  bz_removeEvent(bz_ePlayerJoinEvent, &kothplayerjoined);
  bz_removeEvent(bz_ePlayerDieEvent, &kothplayerdied);
  bz_debugMessage(4, "koth plugin unloaded");
  bz_removeCustomMapObject("KOTH");
  bz_removeCustomSlashCommand("kothstatus");
  bz_removeCustomSlashCommand("kothon");
  bz_removeCustomSlashCommand("kothoff");
  bz_removeCustomSlashCommand("kothsoundon");
  bz_removeCustomSlashCommand("kothsoundoff");
  bz_removeCustomSlashCommand("kothtimemult");
  bz_removeCustomSlashCommand("kothtimemultmin");
  bz_removeCustomSlashCommand("kothtime");
  bz_removeCustomSlashCommand("kothautotimeon");
  bz_removeCustomSlashCommand("kothautotimeoff");
  bz_removeCustomSlashCommand("kingsay");
  bz_clearMaxWaitTime("KOTH");
  return 0;
}
Exemplo n.º 29
0
BZF_PLUGIN_CALL int bz_Load(const char *commandLine)
{
  std::string parameter = commandLine;
  double timelimitparameter = ConvertToInt(parameter);

  if (timelimitparameter > 0)
    tctf.timeLimit = timelimitparameter * 60;

  bz_debugMessage(4, "timedctf plugin loaded");
  bz_registerEvent(bz_eCaptureEvent, &tctfflagcapped);
  bz_registerEvent(bz_ePlayerJoinEvent, &tctfplayerjoined);
  bz_registerEvent(bz_ePlayerUpdateEvent, &tctfplayerupdates);
  bz_registerEvent(bz_eTickEvent, &tctftickevents);
  bz_registerCustomSlashCommand("tctfstatus", &tctfcommands);
  bz_registerCustomSlashCommand("tctftime", &tctfcommands);
  bz_registerCustomSlashCommand("tctfon", &tctfcommands);
  bz_registerCustomSlashCommand("tctfoff", &tctfcommands);
  bz_registerCustomSlashCommand("fairctfon", &tctfcommands);
  bz_registerCustomSlashCommand("fairctfoff", &tctfcommands);
  bz_registerCustomSlashCommand("tctfsoundon", &tctfcommands);
  bz_registerCustomSlashCommand("tctfsoundoff", &tctfcommands);
  return 0;
}
Exemplo n.º 30
0
void LogDetail::Cleanup()
{
  listPlayers( part , NULL );
  bz_debugMessage(0, "SERVER-STATUS Stopped");
  Flush();
}