Browse Source

Replaced RenX_OnVoteCall event with multiple vote-specific events.

pull/3/head
Jessica James 9 years ago
parent
commit
54e8061cde
  1. 2
      Jupiter
  2. BIN
      Release/Plugins/RenX.Core.lib
  3. 2
      RenX.Commands/RenX_Commands.cpp
  4. 44
      RenX.Core/RenX_Plugin.cpp
  5. 12
      RenX.Core/RenX_Plugin.h
  6. 121
      RenX.Core/RenX_Server.cpp
  7. 192
      RenX.Logging/RenX_Logging.cpp
  8. 20
      RenX.Logging/RenX_Logging.h

2
Jupiter

@ -1 +1 @@
Subproject commit 6b8857178ab821141510bd1cf942182840127ac5
Subproject commit 5620679e80b2489358d0bdcb90e03ca5f530dbde

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

2
RenX.Commands/RenX_Commands.cpp

@ -1317,7 +1317,7 @@ void GameOverIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
match = true;
if (parameters.equalsi("empty"_jrs))
server->gameoverWhenEmpty();
if (parameters.equalsi("if empty"_jrs))
else if (parameters.equalsi("if empty"_jrs))
{
if (server->players.size() == server->getBotCount())
server->gameover();

44
RenX.Core/RenX_Plugin.cpp

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014-2015 Jessica James.
* Copyright (C) 2014-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -451,7 +451,47 @@ void RenX::Plugin::RenX_OnAdmin(Server *, const Jupiter::ReadableString &)
return;
}
void RenX::Plugin::RenX_OnVoteCall(Server *, const TeamType &, const Jupiter::ReadableString &, const PlayerInfo *, const Jupiter::ReadableString &)
void RenX::Plugin::RenX_OnVoteAddBots(Server *, const TeamType &, const PlayerInfo *, const TeamType &, int, int)
{
return;
}
void RenX::Plugin::RenX_OnVoteChangeMap(Server *, const TeamType &, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnVoteKick(Server *, const TeamType &, const PlayerInfo *, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnVoteMineBan(Server *, const TeamType &, const PlayerInfo *, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnVoteRemoveBots(Server *, const TeamType &, const PlayerInfo *, const TeamType &, int)
{
return;
}
void RenX::Plugin::RenX_OnVoteRestartMap(Server *, const TeamType &, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnVoteSurrender(Server *, const TeamType &, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnVoteSurvey(Server *, const TeamType &, const PlayerInfo *, const Jupiter::ReadableString &text)
{
return;
}
void RenX::Plugin::RenX_OnVoteOther(Server *, const TeamType &, const Jupiter::ReadableString &, const PlayerInfo *)
{
return;
}

12
RenX.Core/RenX_Plugin.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014-2015 Jessica James.
* Copyright (C) 2014-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -138,7 +138,15 @@ namespace RenX
virtual void RenX_OnAdmin(Server *server, const Jupiter::ReadableString &raw);
/** Vote Type Logs */
virtual void RenX_OnVoteCall(Server *server, const TeamType &team, const Jupiter::ReadableString &type, const PlayerInfo *player, const Jupiter::ReadableString &parameters);
virtual void RenX_OnVoteAddBots(Server *server, const TeamType &team, const PlayerInfo *player, const TeamType &victim, int amount, int skill);
virtual void RenX_OnVoteChangeMap(Server *server, const TeamType &team, const PlayerInfo *player);
virtual void RenX_OnVoteKick(Server *server, const TeamType &team, const PlayerInfo *player, const PlayerInfo *victim);
virtual void RenX_OnVoteMineBan(Server *server, const TeamType &team, const PlayerInfo *player, const PlayerInfo *victim);
virtual void RenX_OnVoteRemoveBots(Server *server, const TeamType &team, const PlayerInfo *player, const TeamType &victim, int amount);
virtual void RenX_OnVoteRestartMap(Server *server, const TeamType &team, const PlayerInfo *player);
virtual void RenX_OnVoteSurrender(Server *server, const TeamType &team, const PlayerInfo *player);
virtual void RenX_OnVoteSurvey(Server *server, const TeamType &team, const PlayerInfo *player, const Jupiter::ReadableString &text);
virtual void RenX_OnVoteOther(Server *server, const TeamType &team, const Jupiter::ReadableString &type, const PlayerInfo *player);
virtual void RenX_OnVoteOver(Server *server, const TeamType &team, const Jupiter::ReadableString &type, bool success, int yesVotes, int noVotes);
virtual void RenX_OnVoteCancel(Server *server, const TeamType &team, const Jupiter::ReadableString &type);
virtual void RenX_OnVote(Server *server, const Jupiter::ReadableString &raw);

121
RenX.Core/RenX_Server.cpp

@ -2624,8 +2624,20 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
if (subHeader.equals("Called;"))
{
// TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "parameters" | Parameters(Empty) | "by" | Player
// TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "by" | Player
// Pre-5.15:
// TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "parameters" | Parameters(Empty) | "by" | Player
// 5.15+:
// TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "by" | Player | Parameters (Key | Value [ ... | Key | Value ] )
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_AddBots" | "by" | Player | "team" | TargetTeam="GDI" / "Nod" / "Both" | "amount" | amount | "skill" | skill
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_ChangeMap" | "by" | Player
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_Kick" | "by" | Player | "player" | Target Player
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_MineBan" | "by" | Player | "player" | Target Player
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_RemoveBots" | "by" | Player | "team" | TargetTeam="GDI" / "Nod" / "Both" | "amount" | amount
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_RestartMap" | "by" | Player
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_Surrender" | "by" | Player
// TeamType="Global" / "GDI" / "Nod" / "" | "Rx_VoteMenuChoice_Survey" | "by" | Player | "text" | Survey Text
Jupiter::ReferenceString voteType = tokens.getToken(3);
Jupiter::ReferenceString teamToken = tokens.getToken(2);
RenX::TeamType team;
@ -2638,23 +2650,110 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
else
team = TeamType::Other;
Jupiter::ReferenceString playerToken;
Jupiter::ReferenceString parameters;
if (tokens.getToken(4).equals("parameters"))
if (tokens.getToken(4).equals("parameters")) // Pre-5.15 style parameters; throw away parameters
{
playerToken = tokens.getToken(tokens.token_count - 1);
parameters = tokens.getToken(5);
}
else
playerToken = tokens.getToken(5);
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(tokens.token_count - 1));
RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerToken);
if ((player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_VOTE) != 0)
RenX::Server::sendData(Jupiter::StringS::Format("ccancelvote %.*s\n", teamToken.size(), teamToken.ptr()));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteOther(this, team, voteType, player);
}
else // 5.15+ (or empty)
{
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(5));
if ((player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_VOTE) != 0)
RenX::Server::sendData(Jupiter::StringS::Format("ccancelvote %.*s\n", teamToken.size(), teamToken.ptr()));
// PARSE PARAMETERS HERE
if (voteType.find("Rx_VoteMenuChoice_"_jrs) == 0)
{
voteType.shiftRight(18);
if (voteType.equals("AddBots"_jrs))
{
Jupiter::ReferenceString victimToken = tokens.getToken(7);
RenX::TeamType victim;
if (teamToken.equals("Global"))
victim = TeamType::None;
else if (teamToken.equals("GDI"))
victim = TeamType::GDI;
else if (teamToken.equals("Nod"))
victim = TeamType::Nod;
else
victim = TeamType::Other;
int amount = tokens.getToken(9).asInt(10);
int skill = tokens.getToken(11).asInt(10);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteAddBots(this, team, player, victim, amount, skill);
}
else if (voteType.equals("ChangeMap"_jrs))
{
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteChangeMap(this, team, player);
}
else if (voteType.equals("Kick"_jrs))
{
RenX::PlayerInfo *victim = parseGetPlayerOrAdd(tokens.getToken(7));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteKick(this, team, player, victim);
}
else if (voteType.equals("MineBan"_jrs))
{
RenX::PlayerInfo *victim = parseGetPlayerOrAdd(tokens.getToken(7));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteMineBan(this, team, player, victim);
}
else if (voteType.equals("RemoveBots"_jrs))
{
Jupiter::ReferenceString victimToken = tokens.getToken(7);
RenX::TeamType victim;
if (teamToken.equals("Global"))
victim = TeamType::None;
else if (teamToken.equals("GDI"))
victim = TeamType::GDI;
else if (teamToken.equals("Nod"))
victim = TeamType::Nod;
else
victim = TeamType::Other;
int amount = tokens.getToken(9).asInt(10);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteRemoveBots(this, team, player, victim, amount);
}
else if (voteType.equals("RestartMap"_jrs))
{
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteCall(this, team, voteType, player, parameters);
xPlugins.get(i)->RenX_OnVoteRestartMap(this, team, player);
}
else if (voteType.equals("Surrender"_jrs))
{
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteSurrender(this, team, player);
}
else if (voteType.equals("Survey"_jrs))
{
const Jupiter::ReadableString &text = tokens.getToken(7);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteSurvey(this, team, player, text);
}
else
{
voteType.shiftLeft(18);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteOther(this, team, voteType, player);
}
}
else
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVoteOther(this, team, voteType, player);
}
onAction();
}
else if (subHeader.equals("Results;"))

192
RenX.Logging/RenX_Logging.cpp

@ -326,8 +326,32 @@ void RenX_LoggingPlugin::init()
RenX_LoggingPlugin::adminFmt = Jupiter::IRC::Client::Config->get(this->getName(), "AdminFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "07[Admin]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
RenX_LoggingPlugin::voteCallFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteCallFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called a \"%.*s\" vote.", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr()));
RenX_LoggingPlugin::voteAddBotsFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteAddBotsFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for adding " IRCCOLOR "12%.*s" IRCCOLOR " bots to %.*s, with skill level " IRCCOLOR "07%.*s" IRCCOLOR ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamShortTag.size(), RenX::tags->victimTeamShortTag.ptr(), RenX::tags->weaponTag.size(), RenX::tags->weaponTag.ptr()));
RenX_LoggingPlugin::voteChangeMapFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteChangeMapFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a Map Change.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
RenX_LoggingPlugin::voteKickFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteKickFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a kick against %.*s" IRCNORMAL ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
RenX_LoggingPlugin::voteMineBanFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteMineBanFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called for a Mine Ban against %.*s" IRCNORMAL ".", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
RenX_LoggingPlugin::voteRemoveBotsFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteRemoveBotsFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called a vote to remove " IRCCOLOR "12%.*s" IRCCOLOR " bots from " IRCCOLOR "%.*s%.*s" IRCNORMAL ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->victimTeamShortTag.size(), RenX::tags->victimTeamShortTag.ptr()));
RenX_LoggingPlugin::voteRestartMapFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteRestartMapFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a Map Restart.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
RenX_LoggingPlugin::voteSurrenderFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteSurrenderFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called for a Surrender.", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
RenX_LoggingPlugin::voteSurveyFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteSurveyFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR "%.*s has started a Survey: " IRCCOLOR "12%.*s", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
RenX_LoggingPlugin::voteOtherFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteOtherFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR "%.*s has called a \"%.*s\" vote.", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr()));
RenX_LoggingPlugin::voteOverSuccessFmt = Jupiter::IRC::Client::Config->get(this->getName(), "VoteOverSuccessFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" " IRCBOLD IRCCOLOR "09passed" IRCBOLD IRCCOLOR "%.*s (Votes Yes: %.*s | Votes No: %.*s).", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->winScoreTag.size(), RenX::tags->winScoreTag.ptr(), RenX::tags->loseScoreTag.size(), RenX::tags->loseScoreTag.ptr()));
@ -458,7 +482,15 @@ void RenX_LoggingPlugin::init()
RenX::sanitizeTags(adminGrantFmt);
RenX::sanitizeTags(adminLogoutFmt);
RenX::sanitizeTags(adminFmt);
RenX::sanitizeTags(voteCallFmt);
RenX::sanitizeTags(voteAddBotsFmt);
RenX::sanitizeTags(voteChangeMapFmt);
RenX::sanitizeTags(voteKickFmt);
RenX::sanitizeTags(voteMineBanFmt);
RenX::sanitizeTags(voteRemoveBotsFmt);
RenX::sanitizeTags(voteRestartMapFmt);
RenX::sanitizeTags(voteSurrenderFmt);
RenX::sanitizeTags(voteSurveyFmt);
RenX::sanitizeTags(voteOtherFmt);
RenX::sanitizeTags(voteOverSuccessFmt);
RenX::sanitizeTags(voteOverFailFmt);
RenX::sanitizeTags(voteCancelFmt);
@ -1684,7 +1716,157 @@ void RenX_LoggingPlugin::RenX_OnAdmin(RenX::Server *server, const Jupiter::Reada
}
}
void RenX_LoggingPlugin::RenX_OnVoteCall(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters)
void RenX_LoggingPlugin::RenX_OnVoteAddBots(RenX::Server *server, const RenX::TeamType &, const RenX::PlayerInfo *player, const RenX::TeamType &victim, int amount, int skill)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteAddBotsFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(victim));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(victim));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(victim));
msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, Jupiter::StringS::Format("%d", amount));
msg.replace(RenX::tags->INTERNAL_WEAPON_TAG, Jupiter::StringS::Format("%d", skill));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteChangeMap(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteChangeMapFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteKick(RenX::Server *server, const RenX::TeamType &, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteKickFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player, victim);
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteMineBan(RenX::Server *server, const RenX::TeamType &, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteMineBanFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player, victim);
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteRemoveBots(RenX::Server *server, const RenX::TeamType &, const RenX::PlayerInfo *player, const RenX::TeamType &victim, int amount)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteRemoveBotsFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(victim));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(victim));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(victim));
msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, Jupiter::StringS::Format("%d", amount));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteRestartMap(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteRestartMapFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteSurrender(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteSurrenderFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteSurvey(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const Jupiter::ReadableString &text)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteSurveyFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team));
msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team));
msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, text);
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnVoteOther(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player)
{
logFuncType func;
if (RenX_LoggingPlugin::voteCallPublic)
@ -1692,7 +1874,7 @@ void RenX_LoggingPlugin::RenX_OnVoteCall(RenX::Server *server, const RenX::TeamT
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->voteCallFmt;
Jupiter::String msg = this->voteOtherFmt;
if (msg.isNotEmpty())
{
RenX::processTags(msg, server, player);

20
RenX.Logging/RenX_Logging.h

@ -91,7 +91,15 @@ public: // RenX::Plugin
void RenX_OnAdminLogout(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnAdmin(RenX::Server *server, const Jupiter::ReadableString &raw) override;
void RenX_OnVoteCall(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters) override;
void RenX_OnVoteAddBots(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const RenX::TeamType &victim, int amount, int skill) override;
void RenX_OnVoteChangeMap(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player) override;
void RenX_OnVoteKick(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim) override;
void RenX_OnVoteMineBan(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim) override;
void RenX_OnVoteRemoveBots(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const RenX::TeamType &victim, int amount) override;
void RenX_OnVoteRestartMap(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player) override;
void RenX_OnVoteSurrender(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player) override;
void RenX_OnVoteSurvey(RenX::Server *server, const RenX::TeamType &team, const RenX::PlayerInfo *player, const Jupiter::ReadableString &text) override;
void RenX_OnVoteOther(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player) override;
void RenX_OnVoteOver(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, bool success, int yesVotes, int noVotes) override;
void RenX_OnVoteCancel(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type) override;
void RenX_OnVote(RenX::Server *server, const Jupiter::ReadableString &raw) override;
@ -270,7 +278,15 @@ private:
Jupiter::StringS adminGrantFmt;
Jupiter::StringS adminLogoutFmt;
Jupiter::StringS adminFmt;
Jupiter::StringS voteCallFmt;
Jupiter::StringS voteAddBotsFmt;
Jupiter::StringS voteChangeMapFmt;
Jupiter::StringS voteKickFmt;
Jupiter::StringS voteMineBanFmt;
Jupiter::StringS voteRemoveBotsFmt;
Jupiter::StringS voteRestartMapFmt;
Jupiter::StringS voteSurrenderFmt;
Jupiter::StringS voteSurveyFmt;
Jupiter::StringS voteOtherFmt;
Jupiter::StringS voteOverSuccessFmt;
Jupiter::StringS voteOverFailFmt;
Jupiter::StringS voteCancelFmt;

Loading…
Cancel
Save