Ejemplo n.º 1
0
void TeamFlagResetHandler::Init ( const char* commandLineParameter )
{
  std::string param = commandLineParameter;
  double timelimitparam = ConvertToInteger(param);

  if (timelimitparam > 0)
	  tfr.idleTime = timelimitparam * 60;

  Register(bz_eTickEvent);
  bz_registerCustomSlashCommand("tfrtime",&teamflagresetiohandler);
  bz_registerCustomSlashCommand("tfroff",&teamflagresetiohandler);
  bz_registerCustomSlashCommand("tfron",&teamflagresetiohandler);
  bz_registerCustomSlashCommand("tfrstatus",&teamflagresetiohandler);
}
Ejemplo n.º 2
0
void ChatEvents::Init ( const char* commandLine )
{
  maxChatLines = 1000;
  if (commandLine)
  {
    int realLines = atoi(commandLine);
    maxChatLines  = realLines;
  }

  bz_registerCustomSlashCommand("last",&lastChatCommand);
  bz_registerCustomSlashCommand("flushchat",&lastChatCommand);

  Register(bz_eRawChatMessageEvent);

}
Ejemplo n.º 3
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));
}
Ejemplo n.º 4
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;
    }
}
Ejemplo n.º 5
0
void TimeLimit::Init ( const char* commandLine )
{
  parseCommand(commandLine);

  saveTimeLimit = bz_getTimeLimit();

  bz_registerCustomSlashCommand ("timelimit",this);
  Register(bz_ePlayerJoinEvent);
  Register(bz_eGameEndEvent);
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
0
void TCTFHandler::Init( const char* commandLine )
{
  std::string parameter = commandLine;
  double timelimitparameter = ConvertToInt(parameter);

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

  Register(bz_eCaptureEvent);
  Register(bz_ePlayerJoinEvent);
  Register(bz_ePlayerUpdateEvent);
  Register(bz_eTickEvent);
  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);
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
0
void leagueOverSeer::Init (const char* commandLine)
{
    bz_debugMessagef(0, "League Over Seer %i.%i.%i (%i) loaded.", MAJOR, MINOR, REV, BUILD);

    Register(bz_eCaptureEvent);
    Register(bz_eGameEndEvent);
    Register(bz_eGameStartEvent);
    Register(bz_eGetPlayerMotto);
    Register(bz_ePlayerJoinEvent);
    Register(bz_eTickEvent);

    bz_registerCustomSlashCommand("official", this);
    bz_registerCustomSlashCommand("fm",this);
    bz_registerCustomSlashCommand("finish",this);
    bz_registerCustomSlashCommand("cancel",this);
    bz_registerCustomSlashCommand("spawn",this);
    bz_registerCustomSlashCommand("resume",this);
    bz_registerCustomSlashCommand("pause",this);

    //Set all boolean values for the plugin to false
    officialMatch = false;
    doNotReportMatch = false;
    matchParticipantsRecorded = false;
    funMatch = false;
    teamOnePoints = 0;
    teamTwoPoints = 0;
    matchDuration = bz_getTimeLimit();
    matchStartTime = 0;
    matchRollCall = 90;

    loadConfig(commandLine); //Load the configuration data when the plugin is loaded

    if (mapchangePath != "" && rotLeague) //Check to see if the plugin is for a rotational league
    {
        //Open the mapchange.out file to see what map is being used
        std::ifstream infile;
        infile.open(mapchangePath.c_str());
        getline(infile,map);
        infile.close();

        map = map.substr(0, map.length() - 5); //Remove the '.conf' from the mapchange.out file

        bz_debugMessagef(DEBUG, "DEBUG :: League Over Seer :: Current map being played: %s", map.c_str());
    }

    teamOne = eNoTeam;
    teamTwo = eNoTeam;

    while (teamOne == eNoTeam || teamTwo == eNoTeam)
    {
        if (bz_getTeamPlayerLimit(eRedTeam) > 0 && teamOne == eNoTeam)
        {
            teamOne = eRedTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(eGreenTeam) > 0 && teamOne == eNoTeam)
        {
            teamOne = eGreenTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(eBlueTeam) > 0 && teamOne == eNoTeam)
        {
            teamOne = eBlueTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(ePurpleTeam) > 0 && teamOne == eNoTeam)
        {
            teamOne = ePurpleTeam;
            continue;
        }

        // Figure out the other team
        if (bz_getTeamPlayerLimit(eRedTeam) > 0 && teamOne != eRedTeam && teamTwo == eNoTeam)
        {
            teamTwo = eRedTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(eGreenTeam) > 0 && teamOne != eGreenTeam && teamTwo == eNoTeam)
        {
            teamTwo = eGreenTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(eBlueTeam) > 0 && teamOne != eBlueTeam && teamTwo == eNoTeam)
        {
            teamTwo = eBlueTeam;
            continue;
        }
        if (bz_getTeamPlayerLimit(ePurpleTeam) > 0 && teamOne != ePurpleTeam && teamTwo == eNoTeam)
        {
            teamTwo = ePurpleTeam;
            continue;
        }
    }

    bz_debugMessagef(0, "DEBUG :: League Over Seer :: Using the following database: %s", SQLiteDB.c_str());
    sqlite3_open(SQLiteDB.c_str(),&db);

    if (db == 0) //we couldn't read the database provided
    {
        bz_debugMessagef(0, "DEBUG :: League Over Seer :: Error! Could not connect to: %s", SQLiteDB.c_str());
        bz_debugMessage(0, "DEBUG :: League Over Seer :: Unloading League Over Seer plugin...");
        bz_unloadPlugin(Name());
    }

    if (db != 0) //if the database connection succeed and the database is empty, let's create the tables needed
        doQuery("CREATE TABLE IF NOT EXISTS [Players] (BZID INTEGER NOT NULL PRIMARY KEY DEFAULT 0, TEAM TEXT NOT NULL DEFAULT Teamless, SQUAD TEXT);");

    // Prepare the SQL query to get the team names based on a BZID
    getPlayerMotto = prepareQuery("SELECT team FROM players WHERE bzid = ?");

    updateTeamNames();
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
void KeepAwayEventHandler::Init(const char* /*commandLine*/)
{
	MaxWaitTime = 0.5f;

	bz_registerCustomMapObject("keepaway",&keepawaymaphandler);
	Register(bz_ePlayerUpdateEvent);
	Register(bz_ePlayerPausedEvent);
	Register(bz_ePlayerPartEvent);
	Register(bz_ePlayerJoinEvent);
	Register(bz_ePlayerDieEvent);
	bz_registerCustomSlashCommand("kastatus",&keepawaycommands);
	bz_registerCustomSlashCommand("kaon",&keepawaycommands);
	bz_registerCustomSlashCommand("kaoff",&keepawaycommands);
	bz_registerCustomSlashCommand("katimemult",&keepawaycommands);
	bz_registerCustomSlashCommand("katimemultmin",&keepawaycommands);
	bz_registerCustomSlashCommand("katime",&keepawaycommands);
	bz_registerCustomSlashCommand("kaautotimeon",&keepawaycommands);
	bz_registerCustomSlashCommand("kaautotimeoff",&keepawaycommands);
	bz_registerCustomSlashCommand("kas",&keepawaycommands);
	bz_registerCustomSlashCommand("kaffon",&keepawaycommands);
	bz_registerCustomSlashCommand("kaffoff",&keepawaycommands);
	bz_registerCustomSlashCommand("kaf",&keepawaycommands);
	bz_registerCustomSlashCommand("kaf+",&keepawaycommands);
	bz_registerCustomSlashCommand("kasoundon",&keepawaycommands);
	bz_registerCustomSlashCommand("kasoundoff",&keepawaycommands);
	bz_registerCustomSlashCommand("kaflagreseton",&keepawaycommands);
	bz_registerCustomSlashCommand("kaflagresetoff",&keepawaycommands);
}
Ejemplo n.º 13
0
void fairCTF::Init ( const char* config )
{
  // Initialize defaults
  allowCTF = true;
  autoMode = true;
  max_ratio = .25;
  max_gap_by_1 = 2;
  max_gap = 3;
  drop_delay = 5;
  
  // Parse out args

  std::string rawparams = config;
  
  std::string params[4];
  params[0] = "";
  params[1] = "";
  params[2] = "";
  params[3] = "";

  unsigned int n = 0;
  
  for(unsigned int i = 0; i < rawparams.length(); i++)
  {
    if (rawparams.at(i) == ':')
    {
      n++;
      
      if (n > 3)
      {
	break;
      }
    }
    else
    {
      params[n] += rawparams.at(i);
    }
  }
  
  if(params[0].length() > 0)
  {
    float tempratio = (float)atof(params[0].c_str());
    if (tempratio > 0.0)
    {
      max_ratio = tempratio;
    }
  }
  
  if(params[1].length() > 0)
  {
    int tempmax1gap = atoi(params[1].c_str());
    if (tempmax1gap > 0)
    {
      max_gap_by_1 = tempmax1gap;
    }
  }
  
  if(params[2].length() > 0)
  {
    int tempmaxgap = atoi(params[2].c_str());
    if (tempmaxgap > 0)
    {
      max_gap = tempmaxgap;
    }
  }
  
  if(params[3].length() > 0)
  {
    int tempdelay = atoi(params[3].c_str());
    if (tempdelay > 0)
    {
      drop_delay = tempdelay;
    }
  }
  
  Register(bz_eAllowFlagGrab);
  Register(bz_ePlayerJoinEvent);
  Register(bz_ePlayerPartEvent);
  Register(bz_eTickEvent);
  
  bz_registerCustomSlashCommand ("ctf", this);

  bz_debugMessage(4,"fairCTF plugin loaded");
  
  UpdateState(eNoTeam);
}
Ejemplo n.º 14
0
void KOTHHandler::Init(const char* /*commandLine*/){
	MaxWaitTime = 0.5f;

	bz_registerCustomMapObject("KOTH",&kothmaphandler);
	Register(bz_ePlayerUpdateEvent);
	Register(bz_ePlayerPausedEvent);
	Register(bz_ePlayerPartEvent);
	Register(bz_ePlayerJoinEvent);
	Register(bz_ePlayerDieEvent);
	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);
}
Ejemplo n.º 15
0
	virtual void Init ( const char* /* config */ )
	{
		bz_registerCustomSlashCommand ( "killall", this );
	}