Browse Source

Replaced all instances of DLList with std::list

Replaced many pointer parameters with reference parameters
Fixed an initialization bug in HTTPServer
Updated Jupiter
pull/4/head
Jessica James 8 years ago
parent
commit
5ebf36ff97
  1. 2
      Bot/Main.cpp
  2. 1
      Configs/RenX.Commands.ini
  3. 6
      HTTPServer/HTTPServer.cpp
  4. 4
      HTTPServer/HTTPServer.h
  5. 2
      Jupiter
  6. 6
      RenX.AlwaysRecord/RenX_AlwaysRecord.cpp
  7. 4
      RenX.AlwaysRecord/RenX_AlwaysRecord.h
  8. 374
      RenX.Commands/RenX_Commands.cpp
  9. 8
      RenX.Commands/RenX_Commands.h
  10. 20
      RenX.Core/RenX_BanDatabase.cpp
  11. 4
      RenX.Core/RenX_BanDatabase.h
  12. 14
      RenX.Core/RenX_ExemptionDatabase.cpp
  13. 6
      RenX.Core/RenX_ExemptionDatabase.h
  14. 44
      RenX.Core/RenX_Functions.cpp
  15. 12
      RenX.Core/RenX_Functions.h
  16. 20
      RenX.Core/RenX_LadderDatabase.cpp
  17. 4
      RenX.Core/RenX_LadderDatabase.h
  18. 234
      RenX.Core/RenX_Plugin.cpp
  19. 232
      RenX.Core/RenX_Plugin.h
  20. 628
      RenX.Core/RenX_Server.cpp
  21. 47
      RenX.Core/RenX_Server.h
  22. 10
      RenX.Core/RenX_Tags.cpp
  23. 22
      RenX.ExcessiveHeadshots/ExcessiveHeadshots.cpp
  24. 4
      RenX.ExcessiveHeadshots/ExcessiveHeadshots.h
  25. 8
      RenX.ExtraLogging/RenX_ExtraLogging.cpp
  26. 4
      RenX.ExtraLogging/RenX_ExtraLogging.h
  27. 12
      RenX.Greetings/RenX_Greetings.cpp
  28. 4
      RenX.Greetings/RenX_Greetings.h
  29. 16
      RenX.HybridUUID/RenX_HybridUUID.cpp
  30. 4
      RenX.HybridUUID/RenX_HybridUUID.h
  31. 4
      RenX.Ladder.Daily/RenX_Ladder_Daily.cpp
  32. 4
      RenX.Ladder.Daily/RenX_Ladder_Daily.h
  33. 4
      RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp
  34. 4
      RenX.Ladder.Monthly/RenX_Ladder_Monthly.h
  35. 4
      RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp
  36. 4
      RenX.Ladder.Weekly/RenX_Ladder_Weekly.h
  37. 4
      RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp
  38. 4
      RenX.Ladder.Yearly/RenX_Ladder_Yearly.h
  39. 34
      RenX.Ladder/RenX_Ladder.cpp
  40. 8
      RenX.Ladder/RenX_Ladder.h
  41. 572
      RenX.Logging/RenX_Logging.cpp
  42. 186
      RenX.Logging/RenX_Logging.h
  43. 172
      RenX.Medals/RenX_Medals.cpp
  44. 22
      RenX.Medals/RenX_Medals.h
  45. 50
      RenX.MinPlayers/RenX_MinPlayers.cpp
  46. 18
      RenX.MinPlayers/RenX_MinPlayers.h
  47. 311
      RenX.ModSystem/RenX_ModSystem.cpp
  48. 28
      RenX.ModSystem/RenX_ModSystem.h
  49. 10
      RenX.NicknameUUID/RenX_NicknameUUID.cpp
  50. 4
      RenX.NicknameUUID/RenX_NicknameUUID.h
  51. 248
      RenX.ServerList/RenX_ServerList.cpp
  52. 14
      RenX.ServerList/RenX_ServerList.h
  53. 38
      RenX.SetJoin/RenX_SetJoin.cpp
  54. 4
      RenX.SetJoin/RenX_SetJoin.h
  55. 28
      RenX.Warn/RenX_Warn.cpp

2
Bot/Main.cpp

@ -104,7 +104,7 @@ int main(int argc, const char **args)
SetConsoleOutputCP(65001); SetConsoleOutputCP(65001);
#endif // _WIN32 #endif // _WIN32
srand(static_cast<unsigned int>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())); srand(static_cast<unsigned int>(std::chrono::system_clock::now().time_since_epoch().count()));
puts(Jupiter::copyright); puts(Jupiter::copyright);
const char *configFileName = "Config.ini"; const char *configFileName = "Config.ini";

1
Configs/RenX.Commands.ini

@ -7,7 +7,6 @@
; StaffTitle=String (Default: Moderator) ; StaffTitle=String (Default: Moderator)
; ;
[RenX.Commands]
TBanTime=86400 TBanTime=86400
;EOF ;EOF

6
HTTPServer/HTTPServer.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -20,9 +20,9 @@
using namespace Jupiter::literals; using namespace Jupiter::literals;
HTTPServerPlugin::HTTPServerPlugin() bool HTTPServerPlugin::initialize()
{ {
HTTPServerPlugin::server.bind(this->config.get("BindAddress"_jrs, "0.0.0.0"_jrs), this->config.get<uint16_t>("BindPort"_jrs, 80)); return HTTPServerPlugin::server.bind(this->config.get("BindAddress"_jrs, "0.0.0.0"_jrs), this->config.get<uint16_t>("BindPort"_jrs, 80));
} }
int HTTPServerPlugin::think() int HTTPServerPlugin::think()

4
HTTPServer/HTTPServer.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -53,7 +53,7 @@
class HTTPSERVER_API HTTPServerPlugin : public Jupiter::Plugin class HTTPSERVER_API HTTPServerPlugin : public Jupiter::Plugin
{ {
public: public:
HTTPServerPlugin(); virtual bool initialize() override;
Jupiter::HTTP::Server server; Jupiter::HTTP::Server server;
public: // Jupiter::Plugin public: // Jupiter::Plugin

2
Jupiter

@ -1 +1 @@
Subproject commit b8983d476abb9c34b77794394e51fa0001f25f8e Subproject commit 89e4050c55eb47f41971c88a24dac99ac10c7603

6
RenX.AlwaysRecord/RenX_AlwaysRecord.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -21,9 +21,9 @@
using namespace Jupiter::literals; using namespace Jupiter::literals;
void RenX_AlwaysRecord::RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &) void RenX_AlwaysRecord::RenX_OnMapStart(RenX::Server &server, const Jupiter::ReadableString &)
{ {
server->send("demorec"_jrs); server.send("demorec"_jrs);
} }
// Plugin instantiation and entry point. // Plugin instantiation and entry point.

4
RenX.AlwaysRecord/RenX_AlwaysRecord.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_AlwaysRecord : public RenX::Plugin class RenX_AlwaysRecord : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &) override; void RenX_OnMapStart(RenX::Server &server, const Jupiter::ReadableString &) override;
}; };
#endif // _RENX_ALWAYSRECORD_H_HEADER #endif // _RENX_ALWAYSRECORD_H_HEADER

374
RenX.Commands/RenX_Commands.cpp

@ -44,23 +44,23 @@ inline bool togglePhasing(RenX::Server *server)
return togglePhasing(server, !server->varData[RxCommandsSection].get<bool>("phasing"_jrs, false)); return togglePhasing(server, !server->varData[RxCommandsSection].get<bool>("phasing"_jrs, false));
} }
inline void onDie(RenX::Server *server, const RenX::PlayerInfo *player) inline void onDie(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (player->isBot && server->varData[RxCommandsSection].get<bool>("phasing"_jrs, false)) if (player.isBot && server.varData[RxCommandsSection].get<bool>("phasing"_jrs, false))
server->kickPlayer(player, Jupiter::StringS::empty); server.kickPlayer(player, Jupiter::StringS::empty);
} }
void RenX_CommandsPlugin::RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &) void RenX_CommandsPlugin::RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &)
{ {
onDie(server, player); onDie(server, player);
} }
void RenX_CommandsPlugin::RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &) void RenX_CommandsPlugin::RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &)
{ {
onDie(server, victim); onDie(server, victim);
} }
void RenX_CommandsPlugin::RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &) void RenX_CommandsPlugin::RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &)
{ {
onDie(server, player); onDie(server, player);
} }
@ -254,7 +254,7 @@ void PMsgIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
{ {
player = server->getPlayerByPartName(name); player = server->getPlayerByPartName(name);
if (player != nullptr) if (player != nullptr)
server->sendMessage(player, msg); server->sendMessage(*player, msg);
else source->sendNotice(nick, Jupiter::StringS::Format("Error: Player \"%.*s\" not found.", name.size(), name.ptr())); else source->sendNotice(nick, Jupiter::StringS::Format("Error: Player \"%.*s\" not found.", name.size(), name.ptr()));
} }
} }
@ -349,9 +349,9 @@ void PlayersIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
} }
// End string containers // End string containers
Jupiter::DLList<Jupiter::String> gStrings; std::list<Jupiter::String *> gStrings;
Jupiter::DLList<Jupiter::String> nStrings; std::list<Jupiter::String *> nStrings;
Jupiter::DLList<Jupiter::String> oStrings; std::list<Jupiter::String *> oStrings;
Jupiter::StringL *gCurrent = nullptr; Jupiter::StringL *gCurrent = nullptr;
Jupiter::StringL *nCurrent = nullptr; Jupiter::StringL *nCurrent = nullptr;
@ -367,72 +367,75 @@ void PlayersIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
unsigned int nBots = 0; unsigned int nBots = 0;
unsigned int oBots = 0; unsigned int oBots = 0;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
if (node->data != nullptr) Jupiter::String &name = RenX::getFormattedPlayerName(*node);
{ if (name.size() > STRING_LENGTH - 32) continue; // Name will be too long to send.
Jupiter::String &name = RenX::getFormattedPlayerName(node->data);
if (name.size() > STRING_LENGTH - 32) continue; // Name will be too long to send.
switch (node->data->team) switch (node->team)
{
case RenX::TeamType::Nod:
if (nCurrent == nullptr || nCurrent->size() + name.size() > STRING_LENGTH)
{ {
case RenX::TeamType::Nod: nCurrent = new Jupiter::StringL(STRING_LENGTH);
if (nCurrent == nullptr || nCurrent->size() + name.size() > STRING_LENGTH) nCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, nTeamColor.size(), nTeamColor.ptr(), nTeam.size(), nTeam.ptr(), name.size(), name.ptr());
{ nStrings.push_back(nCurrent);
nCurrent = new Jupiter::StringL(STRING_LENGTH);
nCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, nTeamColor.size(), nTeamColor.ptr(), nTeam.size(), nTeam.ptr(), name.size(), name.ptr());
nStrings.add(nCurrent);
}
else nCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
nTotal++;
if (node->data->isBot)
nBots++;
break;
case RenX::TeamType::GDI:
if (gCurrent == nullptr || gCurrent->size() + name.size() > STRING_LENGTH)
{
gCurrent = new Jupiter::StringL(STRING_LENGTH);
gCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, gTeamColor.size(), gTeamColor.ptr(), gTeam.size(), gTeam.ptr(), name.size(), name.ptr());
gStrings.add(gCurrent);
}
else gCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
gTotal++;
if (node->data->isBot)
gBots++;
break;
default:
if (oCurrent == nullptr || oCurrent->size() + name.size() > STRING_LENGTH)
{
oCurrent = new Jupiter::StringL(STRING_LENGTH);
oCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, oTeamColor.size(), oTeamColor.ptr(), oTeam.size(), oTeam.ptr(), name.size(), name.ptr());
oStrings.add(oCurrent);
}
else oCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
oTotal++;
if (node->data->isBot)
oBots++;
break;
} }
else nCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
nTotal++;
if (node->isBot)
nBots++;
break;
case RenX::TeamType::GDI:
if (gCurrent == nullptr || gCurrent->size() + name.size() > STRING_LENGTH)
{
gCurrent = new Jupiter::StringL(STRING_LENGTH);
gCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, gTeamColor.size(), gTeamColor.ptr(), gTeam.size(), gTeam.ptr(), name.size(), name.ptr());
gStrings.push_back(gCurrent);
}
else gCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
gTotal++;
if (node->isBot)
gBots++;
break;
default:
if (oCurrent == nullptr || oCurrent->size() + name.size() > STRING_LENGTH)
{
oCurrent = new Jupiter::StringL(STRING_LENGTH);
oCurrent->format(IRCCOLOR "%.*s[%.*s]: " IRCBOLD "%.*s" IRCBOLD, oTeamColor.size(), oTeamColor.ptr(), oTeam.size(), oTeam.ptr(), name.size(), name.ptr());
oStrings.push_back(oCurrent);
}
else oCurrent->aformat(IRCCOLOR ", " IRCBOLD "%.*s" IRCBOLD, name.size(), name.ptr());
oTotal++;
if (node->isBot)
oBots++;
break;
} }
} }
Jupiter::StringL *outString; Jupiter::StringL *outString;
while (gStrings.size() != 0) while (gStrings.size() != 0)
{ {
outString = gStrings.remove(size_t{ 0 }); outString = gStrings.front();
source->sendMessage(channel, *outString); source->sendMessage(channel, *outString);
delete outString; delete outString;
gStrings.pop_front();
} }
while (nStrings.size() != 0) while (nStrings.size() != 0)
{ {
outString = nStrings.remove(size_t{ 0 }); outString = nStrings.front();
source->sendMessage(channel, *outString); source->sendMessage(channel, *outString);
delete outString; delete outString;
nStrings.pop_front();
} }
while (oStrings.size() != 0) while (oStrings.size() != 0)
{ {
outString = oStrings.remove(size_t{ 0 }); outString = oStrings.front();
source->sendMessage(channel, *outString); source->sendMessage(channel, *outString);
delete outString; delete outString;
oStrings.pop_front();
} }
Jupiter::StringL out; Jupiter::StringL out;
@ -516,9 +519,9 @@ void PlayerTableIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStri
double highCredits = 9999999.0; double highCredits = 9999999.0;
RenX::PlayerInfo *player; RenX::PlayerInfo *player;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; player = &*node;
if (player != nullptr && player->isBot == false) if (player != nullptr && player->isBot == false)
{ {
if (player->name.size() > maxNickLen) if (player->name.size() > maxNickLen)
@ -612,12 +615,10 @@ void PlayerInfoIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStrin
if (chan != nullptr) if (chan != nullptr)
{ {
int type = chan->getType(); int type = chan->getType();
RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
RenX::Server *server; RenX::Server *server;
const Jupiter::ReadableString &player_info_format = source->getAccessLevel(channel, nick) > 1 ? pluginInstance.getAdminPlayerInfoFormat() : pluginInstance.getPlayerInfoFormat(); const Jupiter::ReadableString &player_info_format = source->getAccessLevel(channel, nick) > 1 ? pluginInstance.getAdminPlayerInfoFormat() : pluginInstance.getPlayerInfoFormat();
size_t index = 0; size_t index = 0;
Jupiter::DLList<RenX::PlayerInfo>::Node *node;
if (parameters.isEmpty()) // List all players if (parameters.isEmpty()) // List all players
while (index != RenX::getCore()->getServerCount()) while (index != RenX::getCore()->getServerCount())
@ -625,11 +626,10 @@ void PlayerInfoIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStrin
server = RenX::getCore()->getServer(index++); server = RenX::getCore()->getServer(index++);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type) && server->players.size() != 0)
{ {
for (node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data;
msg = player_info_format; msg = player_info_format;
RenX::processTags(msg, server, player); RenX::processTags(msg, server, &*node);
source->sendMessage(channel, msg); source->sendMessage(channel, msg);
} }
} }
@ -640,13 +640,12 @@ void PlayerInfoIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStrin
server = RenX::getCore()->getServer(index++); server = RenX::getCore()->getServer(index++);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type) && server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->name.findi(parameters) != Jupiter::INVALID_INDEX)
if (player->name.findi(parameters) != Jupiter::INVALID_INDEX)
{ {
msg = player_info_format; msg = player_info_format;
RenX::processTags(msg, server, player); RenX::processTags(msg, server, &*node);
source->sendMessage(channel, msg); source->sendMessage(channel, msg);
} }
} }
@ -951,29 +950,29 @@ void SteamIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &ch
if (chan != nullptr) if (chan != nullptr)
{ {
int type = chan->getType(); int type = chan->getType();
RenX::PlayerInfo *player;
if (parameters.isNotEmpty()) if (parameters.isNotEmpty())
{ {
Jupiter::StringL msg; Jupiter::StringL msg;
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type))
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->name.findi(parameters) != Jupiter::INVALID_INDEX)
if (player->name.findi(parameters) != Jupiter::INVALID_INDEX)
{ {
Jupiter::String &playerName = RenX::getFormattedPlayerName(player); Jupiter::String &playerName = RenX::getFormattedPlayerName(*node);
msg.format(IRCCOLOR "03[Steam] " IRCCOLOR "%.*s (ID: %d) ", playerName.size(), playerName.ptr(), player->id); msg.format(IRCCOLOR "03[Steam] " IRCCOLOR "%.*s (ID: %d) ", playerName.size(), playerName.ptr(), node->id);
if (player->steamid != 0) if (node->steamid != 0)
{ {
msg += "is using steam ID " IRCBOLD; msg += "is using steam ID " IRCBOLD;
msg += server->formatSteamID(player); msg += server->formatSteamID(*node);
msg.aformat(IRCBOLD "; Steam Profile: " IRCBOLD "https://steamcommunity.com/profiles/%llu" IRCBOLD, player->steamid); msg.aformat(IRCBOLD "; Steam Profile: " IRCBOLD "https://steamcommunity.com/profiles/%llu" IRCBOLD, node->steamid);
} }
else msg += "is not using steam."; else
msg += "is not using steam.";
source->sendMessage(channel, msg); source->sendMessage(channel, msg);
} }
} }
@ -989,23 +988,24 @@ void SteamIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &ch
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type))
{ {
total = 0; total = 0;
realPlayers = 0; realPlayers = 0;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->isBot == false)
if (player->isBot == false)
{ {
realPlayers++; realPlayers++;
if (player->steamid != 0) if (node->steamid != 0)
total++; total++;
} }
} }
if (realPlayers != 0) if (realPlayers != 0)
source->sendMessage(channel, Jupiter::StringS::Format("%.2f%% (%u/%u) of players are using Steam.", ((double)total * 100) / ((double)realPlayers), total, realPlayers)); source->sendMessage(channel, Jupiter::StringS::Format("%.2f%% (%u/%u) of players are using Steam.", ((double)total * 100) / ((double)realPlayers), total, realPlayers));
else source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("No players are in-game.")); else
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("No players are in-game."));
} }
} }
} }
@ -1038,20 +1038,18 @@ void KillDeathRatioIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableS
if (chan != nullptr) if (chan != nullptr)
{ {
int type = chan->getType(); int type = chan->getType();
RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type) && server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->name.findi(parameters) != Jupiter::INVALID_INDEX)
if (player->name.findi(parameters) != Jupiter::INVALID_INDEX)
{ {
Jupiter::String &playerName = RenX::getFormattedPlayerName(player); Jupiter::String &playerName = RenX::getFormattedPlayerName(*node);
msg.format(IRCBOLD "%.*s" IRCBOLD IRCCOLOR ": Kills: %u - Deaths: %u - KDR: %.2f", playerName.size(), playerName.ptr(), player->kills, player->deaths, static_cast<double>(player->kills) / (player->deaths == 0 ? 1.0f : static_cast<double>(player->deaths))); msg.format(IRCBOLD "%.*s" IRCBOLD IRCCOLOR ": Kills: %u - Deaths: %u - KDR: %.2f", playerName.size(), playerName.ptr(), node->kills, node->deaths, static_cast<double>(node->kills) / (node->deaths == 0 ? 1.0f : static_cast<double>(node->deaths)));
source->sendMessage(channel, msg); source->sendMessage(channel, msg);
} }
} }
@ -1128,7 +1126,6 @@ void ModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
if (chan != nullptr) if (chan != nullptr)
{ {
int type = chan->getType(); int type = chan->getType();
RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle(); const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle();
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
@ -1139,16 +1136,15 @@ void ModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
msg = ""; msg = "";
if (server->players.size() != 0) if (server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->isBot == false && (node->adminType.isNotEmpty() || (node->access != 0 && (node->gamePrefix.isNotEmpty() || node->formatNamePrefix.isNotEmpty()))))
if (player->isBot == false && (player->adminType.isNotEmpty() || (player->access != 0 && (player->gamePrefix.isNotEmpty() || player->formatNamePrefix.isNotEmpty()))))
{ {
if (msg.isNotEmpty()) if (msg.isNotEmpty())
msg += ", "; msg += ", ";
else msg += staff_word + "s in-game: "_jrs; else msg += staff_word + "s in-game: "_jrs;
msg += player->gamePrefix; msg += node->gamePrefix;
msg += player->name; msg += node->name;
} }
} }
} }
@ -1428,8 +1424,8 @@ void MuteIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
server->mute(player); server->mute(*player);
source->sendMessage(channel, RenX::getFormattedPlayerName(player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " has been muted.")); source->sendMessage(channel, RenX::getFormattedPlayerName(*player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " has been muted."));
} }
else else
source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
@ -1477,8 +1473,8 @@ void UnMuteIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
server->unmute(player); server->unmute(*player);
source->sendMessage(channel, RenX::getFormattedPlayerName(player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " has been unmuted.")); source->sendMessage(channel, RenX::getFormattedPlayerName(*player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " has been unmuted."));
} }
else else
source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
@ -1525,7 +1521,7 @@ void KillIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
match = true; match = true;
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
server->kill(player); server->kill(*player);
else else
source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
} }
@ -1572,8 +1568,8 @@ void DisarmIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
if (server->disarm(player)) if (server->disarm(*player))
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All deployables (c4, beacons, etc) belonging to ") + RenX::getFormattedPlayerName(player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All deployables (c4, beacons, etc) belonging to ") + RenX::getFormattedPlayerName(*player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed."));
else else
source->sendMessage(channel, "Error: Server does not support disarms."_jrs); source->sendMessage(channel, "Error: Server does not support disarms."_jrs);
} }
@ -1623,8 +1619,8 @@ void DisarmC4IRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
if (server->disarmC4(player)) if (server->disarmC4(*player))
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All C4 belonging to ") + RenX::getFormattedPlayerName(player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All C4 belonging to ") + RenX::getFormattedPlayerName(*player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed."));
else else
source->sendMessage(channel, "Error: Server does not support disarms."_jrs); source->sendMessage(channel, "Error: Server does not support disarms."_jrs);
} }
@ -1676,8 +1672,8 @@ void DisarmBeaconIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
if (server->disarmBeacon(player)) if (server->disarmBeacon(*player))
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All beacons belonging to ") + RenX::getFormattedPlayerName(player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("All beacons belonging to ") + RenX::getFormattedPlayerName(*player) + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " have been disarmed."));
else else
source->sendMessage(channel, "Error: Server does not support disarms."_jrs); source->sendMessage(channel, "Error: Server does not support disarms."_jrs);
} }
@ -1727,7 +1723,7 @@ void MineBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
player = server->getPlayerByPartName(parameters); player = server->getPlayerByPartName(parameters);
if (player != nullptr) if (player != nullptr)
{ {
server->mineBan(player); server->mineBan(*player);
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Player can no longer place mines.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Player can no longer place mines."));
} }
else else
@ -1782,7 +1778,7 @@ void KickIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
player = server->getPlayerByPartName(name); player = server->getPlayerByPartName(name);
if (player != nullptr) if (player != nullptr)
{ {
server->kickPlayer(player, reason); server->kickPlayer(*player, reason);
++kicks; ++kicks;
} }
} }
@ -1983,7 +1979,7 @@ void TempBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
player = server->getPlayerByPartName(name); player = server->getPlayerByPartName(name);
if (player != nullptr) if (player != nullptr)
{ {
server->banPlayer(player, banner, reason, pluginInstance.getTBanTime()); server->banPlayer(*player, banner, reason, pluginInstance.getTBanTime());
kicks++; kicks++;
} }
} }
@ -2040,7 +2036,7 @@ void KickBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
player = server->getPlayerByPartName(name); player = server->getPlayerByPartName(name);
if (player != nullptr) if (player != nullptr)
{ {
server->banPlayer(player, banner, reason); server->banPlayer(*player, banner, reason);
kicks++; kicks++;
} }
} }
@ -2426,9 +2422,9 @@ void BanExemptIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
if (player != nullptr) if (player != nullptr)
{ {
if (player->steamid != 0LL) if (player->steamid != 0LL)
RenX::exemptionDatabase->add(server, player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN); RenX::exemptionDatabase->add(*server, *player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN);
else else
RenX::exemptionDatabase->add(server, player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_USE_IP); RenX::exemptionDatabase->add(*server, *player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_USE_IP);
++exemptions; ++exemptions;
} }
} }
@ -2489,9 +2485,9 @@ void KickExemptIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStrin
if (player != nullptr) if (player != nullptr)
{ {
if (player->steamid != 0LL) if (player->steamid != 0LL)
RenX::exemptionDatabase->add(server, player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_TYPE_KICK); RenX::exemptionDatabase->add(*server, *player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_TYPE_KICK);
else else
RenX::exemptionDatabase->add(server, player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_TYPE_KICK | RenX::ExemptionDatabase::Entry::FLAG_USE_IP); RenX::exemptionDatabase->add(*server, *player, setter, std::chrono::seconds::zero(), RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN | RenX::ExemptionDatabase::Entry::FLAG_TYPE_KICK | RenX::ExemptionDatabase::Entry::FLAG_USE_IP);
++exemptions; ++exemptions;
} }
} }
@ -2901,10 +2897,10 @@ void RefundIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
player = server->getPlayerByPartName(playerName); player = server->getPlayerByPartName(playerName);
if (player != nullptr) if (player != nullptr)
{ {
if (server->giveCredits(player, credits)) if (server->giveCredits(*player, credits))
{ {
msg.format("You have been refunded %.0f credits by %.*s.", credits, nick.size(), nick.ptr()); msg.format("You have been refunded %.0f credits by %.*s.", credits, nick.size(), nick.ptr());
server->sendMessage(player, msg); server->sendMessage(*player, msg);
msg.format("%.*s has been refunded %.0f credits.", player->name.size(), player->name.ptr(), credits); msg.format("%.*s has been refunded %.0f credits.", player->name.size(), player->name.ptr(), credits);
} }
else else
@ -2948,20 +2944,18 @@ void TeamChangeIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStrin
{ {
int type = chan->getType(); int type = chan->getType();
Jupiter::ReferenceString playerName = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE); Jupiter::ReferenceString playerName = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE);
RenX::PlayerInfo *player;
bool playerFound = false; bool playerFound = false;
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type) && server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->name.findi(playerName) != Jupiter::INVALID_INDEX)
if (player->name.findi(playerName) != Jupiter::INVALID_INDEX)
{ {
playerFound = true; playerFound = true;
if (server->changeTeam(player) == false) if (server->changeTeam(*node) == false)
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Server does not support team changing.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Server does not support team changing."));
} }
} }
@ -3003,20 +2997,18 @@ void TeamChange2IRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStri
{ {
int type = chan->getType(); int type = chan->getType();
Jupiter::ReferenceString playerName = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE); Jupiter::ReferenceString playerName = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE);
RenX::PlayerInfo *player;
bool playerFound = false; bool playerFound = false;
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
if (server->isLogChanType(type) && server->players.size() != 0) if (server->isLogChanType(type) && server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = node->data; if (node->name.findi(playerName) != Jupiter::INVALID_INDEX)
if (player->name.findi(playerName) != Jupiter::INVALID_INDEX)
{ {
playerFound = true; playerFound = true;
if (server->changeTeam(player, false) == false) if (server->changeTeam(*node, false) == false)
source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Server does not support team changing.")); source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Server does not support team changing."));
} }
} }
@ -3076,16 +3068,17 @@ void HelpGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
} }
return list; return list;
}; };
if (parameters.wordCount(WHITESPACE) == 0) if (parameters.wordCount(WHITESPACE) == 0)
{ {
for (int i = 0; i <= player->access; i++) for (int i = 0; i <= player->access; i++)
{ {
Jupiter::ReadableString &msg = getAccessCommands(i); Jupiter::ReadableString &msg = getAccessCommands(i);
if (msg.isNotEmpty()) if (msg.isNotEmpty())
source->sendMessage(player, getAccessCommands(i)); source->sendMessage(*player, getAccessCommands(i));
} }
if (cmdCount == 0) if (cmdCount == 0)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("No listed commands available.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("No listed commands available."));
} }
else else
{ {
@ -3093,12 +3086,12 @@ void HelpGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
if (cmd != nullptr) if (cmd != nullptr)
{ {
if (player->access >= cmd->getAccessLevel()) if (player->access >= cmd->getAccessLevel())
source->sendMessage(player, cmd->getHelp(Jupiter::ReferenceString::gotoWord(parameters, 1, WHITESPACE))); source->sendMessage(*player, cmd->getHelp(Jupiter::ReferenceString::gotoWord(parameters, 1, WHITESPACE)));
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Access Denied.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Access Denied."));
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Command not found.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Error: Command not found."));
} }
} }
@ -3121,20 +3114,19 @@ void ModsGameCommand::create()
void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Jupiter::ReadableString &) void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Jupiter::ReadableString &)
{ {
RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle(); const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle();
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = source->players.getNode(0); node != nullptr; node = node->next) for (auto node = source->players.begin(); node != source->players.end(); ++node)
{ {
player = node->data; if (node->isBot == false && (node->adminType.isNotEmpty() || (node->access != 0 && (node->gamePrefix.isNotEmpty() || node->formatNamePrefix.isNotEmpty()))))
if (player->isBot == false && (player->adminType.isNotEmpty() || (player->access != 0 && (player->gamePrefix.isNotEmpty() || player->formatNamePrefix.isNotEmpty()))))
{ {
if (msg.isEmpty()) if (msg.isEmpty())
msg = staff_word + "s in-game: "_jrs; msg = staff_word + "s in-game: "_jrs;
else else
msg += ", "; msg += ", ";
msg += player->gamePrefix;
msg += player->name; msg += node->gamePrefix;
msg += node->name;
} }
} }
if (msg.isEmpty()) if (msg.isEmpty())
@ -3194,7 +3186,7 @@ void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *play
size_t serverCount = serverManager->size(); size_t serverCount = serverManager->size();
IRC_Bot *server; IRC_Bot *server;
unsigned int messageCount = 0; unsigned int messageCount = 0;
Jupiter::String &fmtName = RenX::getFormattedPlayerName(player); Jupiter::String &fmtName = RenX::getFormattedPlayerName(*player);
Jupiter::StringL user_message = Jupiter::StringL::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game; please look in ", staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr()); Jupiter::StringL user_message = Jupiter::StringL::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game; please look in ", staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
Jupiter::StringS channel_message = Jupiter::StringS::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game!" IRCCOLOR, staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr()); Jupiter::StringS channel_message = Jupiter::StringS::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game!" IRCCOLOR, staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
@ -3219,7 +3211,7 @@ void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *play
} }
}; };
source->sendMessage(player, Jupiter::StringS::Format("A total of %u %.*ss have been notified of your assistance request.", messageCount, staff_word.size(), staff_word.ptr())); source->sendMessage(*player, Jupiter::StringS::Format("A total of %u %.*ss have been notified of your assistance request.", messageCount, staff_word.size(), staff_word.ptr()));
} }
const Jupiter::ReadableString &ModRequestGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ModRequestGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3244,17 +3236,17 @@ void KillGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not kill higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not kill higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->kill(target); source->kill(*target);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been killed.")); source->sendMessage(*player, "Player has been killed."_jrs);
} }
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: kill <player>")); source->sendMessage(*player, "Error: Too few parameters. Syntax: kill <player>"_jrs);
} }
const Jupiter::ReadableString &KillGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &KillGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3279,16 +3271,16 @@ void DisarmGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarm(target) == false) else if (source->disarm(*target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(*player, "Error: Server does not support disarms."_jrs);
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been disarmed.")); source->sendMessage(*player, "Player has been disarmed."_jrs);
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: disarm <player>")); source->sendMessage(*player, "Error: Too few parameters. Syntax: disarm <player>"_jrs);
} }
const Jupiter::ReadableString &DisarmGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &DisarmGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3313,16 +3305,16 @@ void DisarmC4GameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarmC4(target) == false) else if (source->disarmC4(*target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(*player, "Error: Server does not support disarms."_jrs);
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been disarmed.")); source->sendMessage(*player, "Player has been disarmed."_jrs);
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: disarmc4 <player>")); source->sendMessage(*player, "Error: Too few parameters. Syntax: disarmc4 <player>"_jrs);
} }
const Jupiter::ReadableString &DisarmC4GameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &DisarmC4GameCommand::getHelp(const Jupiter::ReadableString &)
@ -3349,16 +3341,16 @@ void DisarmBeaconGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *pl
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarmBeacon(target) == false) else if (source->disarmBeacon(*target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(*player, "Error: Server does not support disarms."_jrs);
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been disarmed.")); source->sendMessage(*player, "Player has been disarmed."_jrs);
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: disarmb <player>")); source->sendMessage(*player, "Error: Too few parameters. Syntax: disarmb <player>"_jrs);
} }
const Jupiter::ReadableString &DisarmBeaconGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &DisarmBeaconGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3383,17 +3375,17 @@ void MineBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not mine-ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not mine-ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->mineBan(target); source->mineBan(*target);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player can no longer place mines.")); source->sendMessage(*player, "Player can no longer place mines."_jrs);
} }
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: mineban <player>")); source->sendMessage(*player, "Error: Too few parameters. Syntax: mineban <player>"_jrs);
} }
const Jupiter::ReadableString &MineBanGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &MineBanGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3422,19 +3414,19 @@ void KickGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason"); Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason");
RenX::PlayerInfo *target = source->getPlayerByPartName(name); RenX::PlayerInfo *target = source->getPlayerByPartName(name);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not kick yourself.")); source->sendMessage(*player, "Error: You cannot kick yourself."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not kick higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not kick higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->kickPlayer(target, reason); source->kickPlayer(*target, reason);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been kicked from the game.")); source->sendMessage(*player, "Player has been kicked from the game."_jrs);
} }
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: kick <player> [Reason]")); source->sendMessage(*player, "Error: Too few parameters. Syntax: kick <player> [Reason]"_jrs);
} }
const Jupiter::ReadableString &KickGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &KickGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3463,19 +3455,19 @@ void TempBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason"); Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason");
RenX::PlayerInfo *target = source->getPlayerByPartName(name); RenX::PlayerInfo *target = source->getPlayerByPartName(name);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself.")); source->sendMessage(*player, "Error: You can not ban yourself."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->banPlayer(target, player->name, reason, pluginInstance.getTBanTime()); source->banPlayer(*target, player->name, reason, pluginInstance.getTBanTime());
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been temporarily banned and kicked from the game.")); source->sendMessage(*player, "Player has been temporarily banned and kicked from the game."_jrs);
} }
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: tban <player> [Reason]")); source->sendMessage(*player, "Error: Too few parameters. Syntax: tban <player> [Reason]"_jrs);
} }
const Jupiter::ReadableString &TempBanGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &TempBanGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3505,20 +3497,20 @@ void KickBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason"); Jupiter::StringS reason = parameters.wordCount(WHITESPACE) > 1 ? Jupiter::StringS::gotoWord(parameters, 1, WHITESPACE) : STRING_LITERAL_AS_REFERENCE("No reason");
RenX::PlayerInfo *target = source->getPlayerByPartName(name); RenX::PlayerInfo *target = source->getPlayerByPartName(name);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself.")); source->sendMessage(*player, "Error: You can not ban yourself."_jrs);
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs); source->sendMessage(*player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->banPlayer(target, player->name, reason); source->banPlayer(*target, player->name, reason);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Player has been banned and kicked from the game.")); source->sendMessage(*player, "Player has been banned and kicked from the game."_jrs);
RenX::getCore()->banCheck(); RenX::getCore()->banCheck();
} }
} }
else else
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Too few parameters. Syntax: ban <player> [reason]")); source->sendMessage(*player, "Error: Too few parameters. Syntax: ban <player> [reason]"_jrs);
} }
const Jupiter::ReadableString &KickBanGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &KickBanGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3568,7 +3560,7 @@ void AddBotsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
cmd += Jupiter::StringS::Format("%u", amount); cmd += Jupiter::StringS::Format("%u", amount);
source->send(cmd); source->send(cmd);
source->sendMessage(player, Jupiter::StringS::Format("%u bots have been added to the server.", amount)); source->sendMessage(*player, Jupiter::StringS::Format("%u bots have been added to the server.", amount));
} }
const Jupiter::ReadableString &AddBotsGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &AddBotsGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3593,7 +3585,7 @@ void KillBotsGameCommand::create()
void KillBotsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters) void KillBotsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters)
{ {
source->send(STRING_LITERAL_AS_REFERENCE("killbots")); source->send(STRING_LITERAL_AS_REFERENCE("killbots"));
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("All bots have been removed from the server.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("All bots have been removed from the server."));
} }
const Jupiter::ReadableString &KillBotsGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &KillBotsGameCommand::getHelp(const Jupiter::ReadableString &)
@ -3618,18 +3610,18 @@ void PhaseBotsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *playe
if (parameters.isEmpty()) if (parameters.isEmpty())
{ {
if (togglePhasing(source)) if (togglePhasing(source))
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been enabled.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been enabled."));
else source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been disabled.")); else source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been disabled."));
} }
else if (parameters.equalsi("true") || parameters.equalsi("on") || parameters.equalsi("start") || parameters.equalsi("1")) else if (parameters.equalsi("true") || parameters.equalsi("on") || parameters.equalsi("start") || parameters.equalsi("1"))
{ {
togglePhasing(source, true); togglePhasing(source, true);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been enabled.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been enabled."));
} }
else else
{ {
togglePhasing(source, false); togglePhasing(source, false);
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been disabled.")); source->sendMessage(*player, STRING_LITERAL_AS_REFERENCE("Bot phasing has been disabled."));
} }
} }

8
RenX.Commands/RenX_Commands.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -28,9 +28,9 @@
class RenX_CommandsPlugin : public RenX::Plugin class RenX_CommandsPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
void RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
void RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
virtual bool initialize() override; virtual bool initialize() override;

20
RenX.Core/RenX_BanDatabase.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -166,21 +166,21 @@ void RenX::BanDatabase::write(RenX::BanDatabase::Entry *entry, FILE *file)
fgetpos(file, std::addressof(RenX::BanDatabase::eof)); fgetpos(file, std::addressof(RenX::BanDatabase::eof));
} }
void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags) void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags)
{ {
Entry *entry = new Entry(); Entry *entry = new Entry();
entry->set_active(); entry->set_active();
entry->flags |= flags; entry->flags |= flags;
entry->timestamp = std::chrono::system_clock::now(); entry->timestamp = std::chrono::system_clock::now();
entry->length = length; entry->length = length;
entry->steamid = player->steamid; entry->steamid = player.steamid;
entry->ip = player->ip32; entry->ip = player.ip32;
entry->prefix_length = 32U; entry->prefix_length = 32U;
entry->hwid = player->hwid; entry->hwid = player.hwid;
if (player->rdns_thread.joinable()) if (player.rdns_thread.joinable())
player->rdns_thread.join(); player.rdns_thread.join();
entry->rdns = player->rdns; entry->rdns = player.rdns;
entry->name = player->name; entry->name = player.name;
entry->banner = banner; entry->banner = banner;
entry->reason = reason; entry->reason = reason;
@ -188,7 +188,7 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player
Jupiter::String pluginData; Jupiter::String pluginData;
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins(); Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins();
for (size_t i = 0; i < xPlugins.size(); i++) for (size_t i = 0; i < xPlugins.size(); i++)
if (xPlugins.get(i)->RenX_OnBan(server, player, pluginData)) if (xPlugins.get(i)->RenX_OnBan(*server, player, pluginData))
entry->varData.set(xPlugins.get(i)->getName(), pluginData); entry->varData.set(xPlugins.get(i)->getName(), pluginData);
entries.add(entry); entries.add(entry);

4
RenX.Core/RenX_BanDatabase.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -143,7 +143,7 @@ namespace RenX
* @param player Data of the player to be banned * @param player Data of the player to be banned
* @param length Duration of the ban * @param length Duration of the ban
*/ */
void add(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags = RenX::BanDatabase::Entry::FLAG_TYPE_GAME); void add(RenX::Server *server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags = RenX::BanDatabase::Entry::FLAG_TYPE_GAME);
/** /**
* @brief Adds a ban entry for a set of player information and immediately writes it to the database. * @brief Adds a ban entry for a set of player information and immediately writes it to the database.

14
RenX.Core/RenX_ExemptionDatabase.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -106,9 +106,9 @@ void RenX::ExemptionDatabase::write(RenX::ExemptionDatabase::Entry *entry, FILE
fgetpos(file, std::addressof(RenX::ExemptionDatabase::eof)); fgetpos(file, std::addressof(RenX::ExemptionDatabase::eof));
} }
void RenX::ExemptionDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags) void RenX::ExemptionDatabase::add(RenX::Server &, const RenX::PlayerInfo &player, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags)
{ {
RenX::ExemptionDatabase::add(player->ip32, 32U, player->steamid, setter, length, flags); RenX::ExemptionDatabase::add(player.ip32, 32U, player.steamid, setter, length, flags);
} }
void RenX::ExemptionDatabase::add(uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags) void RenX::ExemptionDatabase::add(uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags)
@ -146,7 +146,7 @@ bool RenX::ExemptionDatabase::deactivate(size_t index)
return false; return false;
} }
void RenX::ExemptionDatabase::exemption_check(RenX::PlayerInfo *player) void RenX::ExemptionDatabase::exemption_check(RenX::PlayerInfo &player)
{ {
RenX::ExemptionDatabase::Entry *entry; RenX::ExemptionDatabase::Entry *entry;
uint32_t netmask; uint32_t netmask;
@ -159,9 +159,9 @@ void RenX::ExemptionDatabase::exemption_check(RenX::PlayerInfo *player)
if (entry->length == std::chrono::seconds::zero() || entry->timestamp + entry->length < std::chrono::system_clock::now()) if (entry->length == std::chrono::seconds::zero() || entry->timestamp + entry->length < std::chrono::system_clock::now())
{ {
netmask = Jupiter_prefix_length_to_netmask(entry->prefix_length); netmask = Jupiter_prefix_length_to_netmask(entry->prefix_length);
if ((player->steamid != 0 && entry->steamid == player->steamid) // SteamID exemption if ((player.steamid != 0 && entry->steamid == player.steamid) // SteamID exemption
|| (player->ip32 != 0U && (player->ip32 & netmask) == (entry->ip & netmask))) // IP address exemption || (player.ip32 != 0U && (player.ip32 & netmask) == (entry->ip & netmask))) // IP address exemption
player->exemption_flags |= entry->flags; player.exemption_flags |= entry->flags;
} }
else else
RenX::ExemptionDatabase::deactivate(index); RenX::ExemptionDatabase::deactivate(index);

6
RenX.Core/RenX_ExemptionDatabase.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -113,7 +113,7 @@ namespace RenX
* @param player Data of the player to be exempted * @param player Data of the player to be exempted
* @param length Duration of the exempt * @param length Duration of the exempt
*/ */
void add(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags); void add(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &setter, std::chrono::seconds length, uint8_t flags);
/** /**
* @brief Adds an exemption entry for a set of player information and immediately writes it to the database. * @brief Adds an exemption entry for a set of player information and immediately writes it to the database.
@ -159,7 +159,7 @@ namespace RenX
* *
* @param player Player to check exemption flags for * @param player Player to check exemption flags for
*/ */
void exemption_check(RenX::PlayerInfo *player); void exemption_check(RenX::PlayerInfo &player);
/** /**
* @brief Fetches the version of the database file. * @brief Fetches the version of the database file.

44
RenX.Core/RenX_Functions.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -857,12 +857,12 @@ void RenX::initTranslations(Jupiter::Config &translationsFile)
unknownWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Unknown"_jrs, "Unknown"_jrs); unknownWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Unknown"_jrs, "Unknown"_jrs);
} }
Jupiter::String RenX::getFormattedPlayerName(const RenX::PlayerInfo *player) Jupiter::String RenX::getFormattedPlayerName(const RenX::PlayerInfo &player)
{ {
Jupiter::String r = player->formatNamePrefix; Jupiter::String r = player.formatNamePrefix;
r += IRCCOLOR; r += IRCCOLOR;
r += RenX::getTeamColor(player->team); r += RenX::getTeamColor(player.team);
r += player->name; r += player.name;
return r; return r;
} }
@ -871,30 +871,38 @@ Jupiter::StringS RenX::formatGUID(const RenX::Map &map)
return Jupiter::StringS::Format("%.16llX%.16llX", map.guid[0], map.guid[1]); return Jupiter::StringS::Format("%.16llX%.16llX", map.guid[0], map.guid[1]);
} }
std::chrono::milliseconds RenX::getServerTime(const RenX::PlayerInfo *player) std::chrono::milliseconds RenX::getServerTime(const RenX::PlayerInfo &player)
{ {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - player->joinTime); return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - player.joinTime);
} }
Jupiter::StringS RenX::default_uuid_func(RenX::PlayerInfo *player) Jupiter::StringS RenX::default_uuid_func(RenX::PlayerInfo &player)
{ {
if (player->steamid != 0U) if (player.steamid != 0U)
return Jupiter::StringS::Format("0x%.16llX", player->steamid); return Jupiter::StringS::Format("0x%.16llX", player.steamid);
return Jupiter::StringS(); return Jupiter::StringS();
} }
double RenX::getKillDeathRatio(const RenX::PlayerInfo *player, bool includeSuicides) double RenX::getKillDeathRatio(const RenX::PlayerInfo &player, bool includeSuicides)
{ {
double deaths = player->deaths; double deaths = player.deaths;
if (includeSuicides == false) deaths -= player->suicides;
if (deaths == 0) deaths = 1; if (includeSuicides == false)
return ((double)player->kills) / deaths; deaths -= player.suicides;
if (deaths == 0)
deaths = 1;
return static_cast<double>(player.kills) / deaths;
} }
double RenX::getHeadshotKillRatio(const RenX::PlayerInfo *player) double RenX::getHeadshotKillRatio(const RenX::PlayerInfo &player)
{ {
if (player->kills == 0) return 0; if (player.kills == 0)
return ((double)player->headshots) / ((double)player->kills); return 0;
return static_cast<double>(player.headshots) / static_cast<double>(player.kills);
} }
Jupiter::String RenX::escapifyRCON(const Jupiter::ReadableString &str) Jupiter::String RenX::escapifyRCON(const Jupiter::ReadableString &str)

12
RenX.Core/RenX_Functions.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -135,7 +135,7 @@ namespace RenX
* @param player Data of the player * @param player Data of the player
* @return IRC-ready version of the player's name. * @return IRC-ready version of the player's name.
*/ */
RENX_API Jupiter::String getFormattedPlayerName(const RenX::PlayerInfo *player); RENX_API Jupiter::String getFormattedPlayerName(const RenX::PlayerInfo &player);
/** /**
* @brief Creates a string containing a human-readable version of a map's GUID * @brief Creates a string containing a human-readable version of a map's GUID
@ -151,7 +151,7 @@ namespace RenX
* @param player A player's data. * @param player A player's data.
* @return Number of seconds a player has been in-game. * @return Number of seconds a player has been in-game.
*/ */
RENX_API std::chrono::milliseconds getServerTime(const RenX::PlayerInfo *player); RENX_API std::chrono::milliseconds getServerTime(const RenX::PlayerInfo &player);
/** /**
* @brief Calculates a player's UUID, based on their steam ID. * @brief Calculates a player's UUID, based on their steam ID.
@ -160,7 +160,7 @@ namespace RenX
* @param player Player to calculate UUID of * @param player Player to calculate UUID of
* @return UUID of the player based on their steam ID. * @return UUID of the player based on their steam ID.
*/ */
RENX_API Jupiter::StringS default_uuid_func(RenX::PlayerInfo *player); RENX_API Jupiter::StringS default_uuid_func(RenX::PlayerInfo &player);
/** /**
* @brief Calculates a player's Kill-Death ratio, based on their data. * @brief Calculates a player's Kill-Death ratio, based on their data.
@ -170,7 +170,7 @@ namespace RenX
* @param includeSuicides True if suicides should be included in the death count, false otherwise. * @param includeSuicides True if suicides should be included in the death count, false otherwise.
* @return Player's Kill-Death ratio. * @return Player's Kill-Death ratio.
*/ */
RENX_API double getKillDeathRatio(const RenX::PlayerInfo *player, bool includeSuicides = true); RENX_API double getKillDeathRatio(const RenX::PlayerInfo &player, bool includeSuicides = true);
/** /**
* @brief Calculates a player's Headshot-Kill ratio, based on their data. * @brief Calculates a player's Headshot-Kill ratio, based on their data.
@ -179,7 +179,7 @@ namespace RenX
* @param player A player's data. * @param player A player's data.
* @return Player's Headshot-Kill ratio. * @return Player's Headshot-Kill ratio.
*/ */
RENX_API double getHeadshotKillRatio(const RenX::PlayerInfo *player); RENX_API double getHeadshotKillRatio(const RenX::PlayerInfo &player);
/** /**
* @brief Escapifies a string so that it can be safely transmitted over RCON. * @brief Escapifies a string so that it can be safely transmitted over RCON.

20
RenX.Core/RenX_LadderDatabase.cpp

@ -474,20 +474,18 @@ void RenX::LadderDatabase::sort_entries()
RenX::LadderDatabase::last_sort = std::chrono::steady_clock::now(); RenX::LadderDatabase::last_sort = std::chrono::steady_clock::now();
} }
void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamType &team) void RenX::LadderDatabase::updateLadder(RenX::Server &server, const RenX::TeamType &team)
{ {
if (server->players.size() != server->getBotCount()) if (server.players.size() != server.getBotCount())
{ {
// call the PreUpdateLadder event // call the PreUpdateLadder event
if (this->OnPreUpdateLadder != nullptr) if (this->OnPreUpdateLadder != nullptr)
this->OnPreUpdateLadder(*this, server, team); this->OnPreUpdateLadder(*this, server, team);
// update player stats in memory // update player stats in memory
RenX::PlayerInfo *player;
RenX::LadderDatabase::Entry *entry; RenX::LadderDatabase::Entry *entry;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto player = server.players.begin(); player != server.players.end(); ++player)
{ {
player = node->data;
if (player->steamid != 0 && (player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_LADDER) == 0) if (player->steamid != 0 && (player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_LADDER) == 0)
{ {
entry = RenX::LadderDatabase::getPlayerEntry(player->steamid); entry = RenX::LadderDatabase::getPlayerEntry(player->steamid);
@ -507,7 +505,7 @@ void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamTy
entry->total_building_kills += player->buildingKills; entry->total_building_kills += player->buildingKills;
entry->total_defence_kills += player->defenceKills; entry->total_defence_kills += player->defenceKills;
entry->total_captures += player->captures; entry->total_captures += player->captures;
entry->total_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server->getGameTime(player)).count()); entry->total_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server.getGameTime(*player)).count());
entry->total_beacon_placements += player->beaconPlacements; entry->total_beacon_placements += player->beaconPlacements;
entry->total_beacon_disarms += player->beaconDisarms; entry->total_beacon_disarms += player->beaconDisarms;
entry->total_proxy_placements += player->proxy_placements; entry->total_proxy_placements += player->proxy_placements;
@ -523,7 +521,7 @@ void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamTy
else if (team == RenX::TeamType::None) else if (team == RenX::TeamType::None)
++entry->total_gdi_ties; ++entry->total_gdi_ties;
entry->total_gdi_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server->getGameTime(player)).count()); entry->total_gdi_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server.getGameTime(*player)).count());
entry->total_gdi_score += static_cast<uint64_t>(player->score); entry->total_gdi_score += static_cast<uint64_t>(player->score);
entry->total_gdi_beacon_placements += player->beaconPlacements; entry->total_gdi_beacon_placements += player->beaconPlacements;
entry->total_gdi_beacon_disarms += player->beaconDisarms; entry->total_gdi_beacon_disarms += player->beaconDisarms;
@ -543,7 +541,7 @@ void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamTy
else if (team == RenX::TeamType::None) else if (team == RenX::TeamType::None)
++entry->total_nod_ties; ++entry->total_nod_ties;
entry->total_nod_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server->getGameTime(player)).count()); entry->total_nod_game_time += static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server.getGameTime(*player)).count());
entry->total_nod_score += static_cast<uint64_t>(player->score); entry->total_nod_score += static_cast<uint64_t>(player->score);
entry->total_nod_beacon_placements += player->beaconPlacements; entry->total_nod_beacon_placements += player->beaconPlacements;
entry->total_nod_beacon_disarms += player->beaconDisarms; entry->total_nod_beacon_disarms += player->beaconDisarms;
@ -576,7 +574,7 @@ void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamTy
set_if_greater(entry->top_building_kills, player->buildingKills); set_if_greater(entry->top_building_kills, player->buildingKills);
set_if_greater(entry->top_defence_kills, player->defenceKills); set_if_greater(entry->top_defence_kills, player->defenceKills);
set_if_greater(entry->top_captures, player->captures); set_if_greater(entry->top_captures, player->captures);
set_if_greater(entry->top_game_time, static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server->getGameTime(player)).count())); set_if_greater(entry->top_game_time, static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(server.getGameTime(*player)).count()));
set_if_greater(entry->top_beacon_placements, player->beaconPlacements); set_if_greater(entry->top_beacon_placements, player->beaconPlacements);
set_if_greater(entry->top_beacon_disarms, player->beaconDisarms); set_if_greater(entry->top_beacon_disarms, player->beaconDisarms);
set_if_greater(entry->top_proxy_placements, player->proxy_placements); set_if_greater(entry->top_proxy_placements, player->proxy_placements);
@ -600,12 +598,12 @@ void RenX::LadderDatabase::updateLadder(RenX::Server *server, const RenX::TeamTy
if (RenX::LadderDatabase::output_times) if (RenX::LadderDatabase::output_times)
{ {
Jupiter::StringS str = Jupiter::StringS::Format("Ladder: %u entries sorted in %f seconds; Database written in %f seconds." ENDL, Jupiter::StringS str = Jupiter::StringS::Format("Ladder: %zu entries sorted in %f seconds; Database written in %f seconds." ENDL,
RenX::LadderDatabase::getEntries(), RenX::LadderDatabase::getEntries(),
static_cast<double>(sort_duration.count()) * (static_cast<double>(std::chrono::steady_clock::duration::period::num) / static_cast<double>(std::chrono::steady_clock::duration::period::den) * static_cast<double>(std::chrono::seconds::duration::period::den / std::chrono::seconds::duration::period::num)), static_cast<double>(sort_duration.count()) * (static_cast<double>(std::chrono::steady_clock::duration::period::num) / static_cast<double>(std::chrono::steady_clock::duration::period::den) * static_cast<double>(std::chrono::seconds::duration::period::den / std::chrono::seconds::duration::period::num)),
static_cast<double>(write_duration.count()) * (static_cast<double>(std::chrono::steady_clock::duration::period::num) / static_cast<double>(std::chrono::steady_clock::duration::period::den) * static_cast<double>(std::chrono::seconds::duration::period::den / std::chrono::seconds::duration::period::num))); static_cast<double>(write_duration.count()) * (static_cast<double>(std::chrono::steady_clock::duration::period::num) / static_cast<double>(std::chrono::steady_clock::duration::period::den) * static_cast<double>(std::chrono::seconds::duration::period::den / std::chrono::seconds::duration::period::num)));
str.println(stdout); str.println(stdout);
server->sendLogChan(str); server.sendLogChan(str);
} }
} }
} }

4
RenX.Core/RenX_LadderDatabase.h

@ -177,7 +177,7 @@ namespace RenX
* @param team Team which just won * @param team Team which just won
* @param output_times True if the sort/write times should be output, false otherwise. * @param output_times True if the sort/write times should be output, false otherwise.
*/ */
void updateLadder(RenX::Server *server, const RenX::TeamType &team); void updateLadder(RenX::Server &server, const RenX::TeamType &team);
/** /**
* @brief Erases all entries in the database. * @brief Erases all entries in the database.
@ -223,7 +223,7 @@ namespace RenX
*/ */
~LadderDatabase(); ~LadderDatabase();
typedef void PreUpdateLadderFunction(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team); typedef void PreUpdateLadderFunction(RenX::LadderDatabase &database, RenX::Server &server, const RenX::TeamType &team);
PreUpdateLadderFunction *OnPreUpdateLadder = nullptr; PreUpdateLadderFunction *OnPreUpdateLadder = nullptr;
private: private:

234
RenX.Core/RenX_Plugin.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -41,582 +41,582 @@ void RenX::Plugin::RenX_SanitizeTags(Jupiter::StringType &)
return; return;
} }
void RenX::Plugin::RenX_ProcessTags(Jupiter::StringType &, const RenX::Server *, const RenX::PlayerInfo *, const RenX::PlayerInfo *, const RenX::BuildingInfo *) void RenX::Plugin::RenX_ProcessTags(Jupiter::StringType &, const Server *, const PlayerInfo *, const PlayerInfo *, const BuildingInfo *)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerCreate(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnPlayerCreate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerDelete(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnPlayerDelete(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerUUIDChange(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnPlayerUUIDChange(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerRDNS(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnPlayerRDNS(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerIdentify(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnPlayerIdentify(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnServerCreate(Server *) void RenX::Plugin::RenX_OnServerCreate(Server &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnServerFullyConnected(Server *) void RenX::Plugin::RenX_OnServerFullyConnected(Server &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnServerDisconnect(Server *, RenX::DisconnectReason) void RenX::Plugin::RenX_OnServerDisconnect(Server &, RenX::DisconnectReason)
{ {
return; return;
} }
bool RenX::Plugin::RenX_OnBan(Server *, const RenX::PlayerInfo *, Jupiter::StringType &) bool RenX::Plugin::RenX_OnBan(Server &, const PlayerInfo &, Jupiter::StringType &)
{ {
return false; return false;
} }
void RenX::Plugin::RenX_OnJoin(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnJoin(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPart(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnPart(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnKick(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &reason) void RenX::Plugin::RenX_OnKick(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnNameChange(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnNameChange(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnTeamChange(Server *, const PlayerInfo *, const TeamType &) void RenX::Plugin::RenX_OnTeamChange(Server &, const PlayerInfo &, const TeamType &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnHWID(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnHWID(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnIDChange(Server *, const PlayerInfo *, int) void RenX::Plugin::RenX_OnIDChange(Server &, const PlayerInfo &, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDev(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnDev(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRank(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnRank(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnExecute(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnExecute(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayerCommand(Server *, const PlayerInfo *, const Jupiter::ReadableString &, GameCommand *) void RenX::Plugin::RenX_OnPlayerCommand(Server &, const PlayerInfo &, const Jupiter::ReadableString &, GameCommand *)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSpeedHack(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnSpeedHack(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnPlayer(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnPlayer(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnChat(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnChat(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnTeamChat(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnTeamChat(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRadioChat(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnRadioChat(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnHostChat(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnHostChat(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnHostPage(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnHostPage(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnOtherChat(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnOtherChat(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDeploy(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDeploy(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnOverMine(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnOverMine(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDisarm(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDisarm(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDisarm(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnDisarm(Server &, const PlayerInfo &, const Jupiter::ReadableString &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnExplode(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnExplode(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnExplode(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnExplode(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSuicide(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnSuicide(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnKill(Server *, const RenX::PlayerInfo *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnKill(Server &, const PlayerInfo &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnKill(Server *, const Jupiter::ReadableString &, const TeamType &, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnKill(Server &, const Jupiter::ReadableString &, const TeamType &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDie(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDie(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDie(Server *, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDie(Server &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDestroy(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, ObjectType) void RenX::Plugin::RenX_OnDestroy(Server &, const PlayerInfo &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, ObjectType)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDestroy(Server *, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, ObjectType) void RenX::Plugin::RenX_OnDestroy(Server &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, ObjectType)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnCapture(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const TeamType &) void RenX::Plugin::RenX_OnCapture(Server &, const PlayerInfo &, const Jupiter::ReadableString &, const TeamType &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnNeutralize(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const TeamType &) void RenX::Plugin::RenX_OnNeutralize(Server &, const PlayerInfo &, const Jupiter::ReadableString &, const TeamType &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnCharacterPurchase(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnCharacterPurchase(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnItemPurchase(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnItemPurchase(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnWeaponPurchase(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnWeaponPurchase(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRefillPurchase(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnRefillPurchase(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVehiclePurchase(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVehiclePurchase(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVehicleSpawn(Server *, const TeamType &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVehicleSpawn(Server &, const TeamType &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSpawn(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnSpawn(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnBotJoin(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnBotJoin(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVehicleCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVehicleCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnTSVehicleCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnTSVehicleCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRAVehicleCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnRAVehicleCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDeathCrate(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnDeathCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnMoneyCrate(Server *, const PlayerInfo *, int) void RenX::Plugin::RenX_OnMoneyCrate(Server &, const PlayerInfo &, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnCharacterCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnCharacterCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSpyCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnSpyCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRefillCrate(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnRefillCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnTimeBombCrate(Server *server, const PlayerInfo *player) void RenX::Plugin::RenX_OnTimeBombCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSpeedCrate(Server *server, const PlayerInfo *player) void RenX::Plugin::RenX_OnSpeedCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnNukeCrate(Server *server, const PlayerInfo *player) void RenX::Plugin::RenX_OnNukeCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAbductionCrate(Server *server, const PlayerInfo *player) void RenX::Plugin::RenX_OnAbductionCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnUnspecifiedCrate(Server *server, const PlayerInfo *player) void RenX::Plugin::RenX_OnUnspecifiedCrate(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnOtherCrate(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnOtherCrate(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSteal(Server *, const PlayerInfo *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnSteal(Server &, const PlayerInfo &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSteal(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const PlayerInfo *) void RenX::Plugin::RenX_OnSteal(Server &, const PlayerInfo &, const Jupiter::ReadableString &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDonate(Server *, const PlayerInfo *, const PlayerInfo *, double) void RenX::Plugin::RenX_OnDonate(Server &, const PlayerInfo &, const PlayerInfo &, double)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnGameOver(Server *, RenX::WinType, const TeamType &, int, int) void RenX::Plugin::RenX_OnGameOver(Server &, RenX::WinType, const TeamType &, int, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnGame(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnGame(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnExecute(Server *, const Jupiter::ReadableString &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnExecute(Server &, const Jupiter::ReadableString &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnSubscribe(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnSubscribe(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnUnsubscribe(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnUnsubscribe(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnBlock(Server *, const Jupiter::ReadableString &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnBlock(Server &, const Jupiter::ReadableString &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnConnect(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnConnect(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAuthenticate(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnAuthenticate(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnBan(Server *, const Jupiter::ReadableString &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnBan(Server &, const Jupiter::ReadableString &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnInvalidPassword(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnInvalidPassword(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDrop(Server *, const Jupiter::ReadableString &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDrop(Server &, const Jupiter::ReadableString &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDisconnect(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDisconnect(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnStopListen(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnStopListen(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnResumeListen(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnResumeListen(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnWarning(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnWarning(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRCON(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnRCON(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAdminLogin(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnAdminLogin(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAdminGrant(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnAdminGrant(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAdminLogout(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnAdminLogout(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAdmin(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnAdmin(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteAddBots(Server *, const TeamType &, const PlayerInfo *, const TeamType &, int, int) void RenX::Plugin::RenX_OnVoteAddBots(Server &, const TeamType &, const PlayerInfo &, const TeamType &, int, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteChangeMap(Server *, const TeamType &, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteChangeMap(Server &, const TeamType &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteKick(Server *, const TeamType &, const PlayerInfo *, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteKick(Server &, const TeamType &, const PlayerInfo &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteMineBan(Server *, const TeamType &, const PlayerInfo *, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteMineBan(Server &, const TeamType &, const PlayerInfo &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteRemoveBots(Server *, const TeamType &, const PlayerInfo *, const TeamType &, int) void RenX::Plugin::RenX_OnVoteRemoveBots(Server &, const TeamType &, const PlayerInfo &, const TeamType &, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteRestartMap(Server *, const TeamType &, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteRestartMap(Server &, const TeamType &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteSurrender(Server *, const TeamType &, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteSurrender(Server &, const TeamType &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteSurvey(Server *, const TeamType &, const PlayerInfo *, const Jupiter::ReadableString &text) void RenX::Plugin::RenX_OnVoteSurvey(Server &, const TeamType &, const PlayerInfo &, const Jupiter::ReadableString &text)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteOther(Server *, const TeamType &, const Jupiter::ReadableString &, const PlayerInfo *) void RenX::Plugin::RenX_OnVoteOther(Server &, const TeamType &, const Jupiter::ReadableString &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteOver(Server *, const TeamType &, const Jupiter::ReadableString &, bool, int, int) void RenX::Plugin::RenX_OnVoteOver(Server &, const TeamType &, const Jupiter::ReadableString &, bool, int, int)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVoteCancel(Server *, const TeamType &, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVoteCancel(Server &, const TeamType &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVote(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVote(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnMapChange(Server *, const Jupiter::ReadableString &, bool) void RenX::Plugin::RenX_OnMapChange(Server &, const Jupiter::ReadableString &, bool)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnMapLoad(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnMapLoad(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnMapStart(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnMapStart(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnMap(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnMap(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDemoRecord(Server *, const PlayerInfo *) void RenX::Plugin::RenX_OnDemoRecord(Server &, const PlayerInfo &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDemoRecord(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDemoRecord(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDemoRecordStop(Server *) void RenX::Plugin::RenX_OnDemoRecordStop(Server &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnDemo(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnDemo(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnLog(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnLog(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnCommand(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnCommand(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnError(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnError(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnVersion(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnVersion(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnAuthorized(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnAuthorized(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnOther(Server *, char, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnOther(Server &, char, const Jupiter::ReadableString &)
{ {
return; return;
} }
void RenX::Plugin::RenX_OnRaw(Server *, const Jupiter::ReadableString &) void RenX::Plugin::RenX_OnRaw(Server &, const Jupiter::ReadableString &)
{ {
return; return;
} }

232
RenX.Core/RenX_Plugin.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -46,151 +46,151 @@ namespace RenX
virtual void RenX_ProcessTags(Jupiter::StringType &msg, const Server *server, const PlayerInfo *player, const PlayerInfo *victim, const BuildingInfo *building); virtual void RenX_ProcessTags(Jupiter::StringType &msg, const Server *server, const PlayerInfo *player, const PlayerInfo *victim, const BuildingInfo *building);
/** Non-RCON RenX logs */ /** Non-RCON RenX logs */
virtual void RenX_OnPlayerCreate(Server *server, const PlayerInfo *player); virtual void RenX_OnPlayerCreate(Server &server, const PlayerInfo &player);
virtual void RenX_OnPlayerDelete(Server *server, const PlayerInfo *player); virtual void RenX_OnPlayerDelete(Server &server, const PlayerInfo &player);
virtual void RenX_OnPlayerUUIDChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newUUID); virtual void RenX_OnPlayerUUIDChange(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &newUUID);
virtual void RenX_OnPlayerRDNS(Server *server, const PlayerInfo *player); virtual void RenX_OnPlayerRDNS(Server &server, const PlayerInfo &player);
virtual void RenX_OnPlayerIdentify(Server *server, const PlayerInfo *player); virtual void RenX_OnPlayerIdentify(Server &server, const PlayerInfo &player);
virtual void RenX_OnServerCreate(Server *server); virtual void RenX_OnServerCreate(Server &server);
virtual void RenX_OnServerFullyConnected(Server *server); virtual void RenX_OnServerFullyConnected(Server &server);
virtual void RenX_OnServerDisconnect(Server *server, RenX::DisconnectReason reason); virtual void RenX_OnServerDisconnect(Server &server, RenX::DisconnectReason reason);
virtual bool RenX_OnBan(Server *server, const PlayerInfo *player, Jupiter::StringType &data); virtual bool RenX_OnBan(Server &server, const PlayerInfo &player, Jupiter::StringType &data);
/** Player type logs */ /** Player type logs */
virtual void RenX_OnJoin(Server *server, const PlayerInfo *player); virtual void RenX_OnJoin(Server &server, const PlayerInfo &player);
virtual void RenX_OnPart(Server *server, const PlayerInfo *player); virtual void RenX_OnPart(Server &server, const PlayerInfo &player);
virtual void RenX_OnKick(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &reason); virtual void RenX_OnKick(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &reason);
virtual void RenX_OnNameChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newPlayerName); virtual void RenX_OnNameChange(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &newPlayerName);
virtual void RenX_OnTeamChange(Server *server, const PlayerInfo *player, const TeamType &oldTeam); virtual void RenX_OnTeamChange(Server &server, const PlayerInfo &player, const TeamType &oldTeam);
virtual void RenX_OnHWID(Server *server, const PlayerInfo *player); virtual void RenX_OnHWID(Server &server, const PlayerInfo &player);
virtual void RenX_OnIDChange(Server *server, const PlayerInfo *player, int oldID); virtual void RenX_OnIDChange(Server &server, const PlayerInfo &player, int oldID);
virtual void RenX_OnRank(Server *server, const PlayerInfo *player); virtual void RenX_OnRank(Server &server, const PlayerInfo &player);
virtual void RenX_OnDev(Server *server, const PlayerInfo *player); virtual void RenX_OnDev(Server &server, const PlayerInfo &player);
virtual void RenX_OnExecute(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &command); virtual void RenX_OnExecute(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &command);
virtual void RenX_OnPlayerCommand(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message, GameCommand *command); virtual void RenX_OnPlayerCommand(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &message, GameCommand *command);
virtual void RenX_OnSpeedHack(Server *server, const PlayerInfo *player); virtual void RenX_OnSpeedHack(Server &server, const PlayerInfo &player);
virtual void RenX_OnPlayer(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnPlayer(Server &server, const Jupiter::ReadableString &raw);
/** Chat type logs */ /** Chat type logs */
virtual void RenX_OnChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); virtual void RenX_OnChat(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &message);
virtual void RenX_OnTeamChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); virtual void RenX_OnTeamChat(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &message);
virtual void RenX_OnRadioChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); virtual void RenX_OnRadioChat(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &message);
virtual void RenX_OnHostChat(Server *server, const Jupiter::ReadableString &message); virtual void RenX_OnHostChat(Server &server, const Jupiter::ReadableString &message);
virtual void RenX_OnHostPage(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); virtual void RenX_OnHostPage(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &message);
virtual void RenX_OnOtherChat(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnOtherChat(Server &server, const Jupiter::ReadableString &raw);
/** Game type logs */ /** Game type logs */
virtual void RenX_OnDeploy(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object); virtual void RenX_OnDeploy(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &object);
virtual void RenX_OnOverMine(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &location); virtual void RenX_OnOverMine(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &location);
virtual void RenX_OnDisarm(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object); virtual void RenX_OnDisarm(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &object);
virtual void RenX_OnDisarm(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object, const PlayerInfo *victim); virtual void RenX_OnDisarm(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &object, const PlayerInfo &victim);
virtual void RenX_OnExplode(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object); virtual void RenX_OnExplode(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &object);
virtual void RenX_OnExplode(Server *server, const Jupiter::ReadableString &object); virtual void RenX_OnExplode(Server &server, const Jupiter::ReadableString &object);
virtual void RenX_OnSuicide(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &damageType); virtual void RenX_OnSuicide(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &damageType);
virtual void RenX_OnKill(Server *server, const PlayerInfo *player, const PlayerInfo *victim, const Jupiter::ReadableString &damageType); virtual void RenX_OnKill(Server &server, const PlayerInfo &player, const PlayerInfo &victim, const Jupiter::ReadableString &damageType);
virtual void RenX_OnKill(Server *server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const PlayerInfo *victim, const Jupiter::ReadableString &damageType); virtual void RenX_OnKill(Server &server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const PlayerInfo &victim, const Jupiter::ReadableString &damageType);
virtual void RenX_OnDie(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &damageType); virtual void RenX_OnDie(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &damageType);
virtual void RenX_OnDie(Server *server, const Jupiter::ReadableString &object, const TeamType &objectTeam, const Jupiter::ReadableString &damageType); virtual void RenX_OnDie(Server &server, const Jupiter::ReadableString &object, const TeamType &objectTeam, const Jupiter::ReadableString &damageType);
virtual void RenX_OnDestroy(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &objectName, const TeamType &victimTeam, const Jupiter::ReadableString &damageType, ObjectType type); virtual void RenX_OnDestroy(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &objectName, const TeamType &victimTeam, const Jupiter::ReadableString &damageType, ObjectType type);
virtual void RenX_OnDestroy(Server *server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const Jupiter::ReadableString &objectName, const TeamType &objectTeam, const Jupiter::ReadableString &damageType, ObjectType type); virtual void RenX_OnDestroy(Server &server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const Jupiter::ReadableString &objectName, const TeamType &objectTeam, const Jupiter::ReadableString &damageType, ObjectType type);
virtual void RenX_OnCapture(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &building, const TeamType &oldTeam); virtual void RenX_OnCapture(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &building, const TeamType &oldTeam);
virtual void RenX_OnNeutralize(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &building, const TeamType &oldTeam); virtual void RenX_OnNeutralize(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &building, const TeamType &oldTeam);
virtual void RenX_OnCharacterPurchase(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character); virtual void RenX_OnCharacterPurchase(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &character);
virtual void RenX_OnItemPurchase(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &item); virtual void RenX_OnItemPurchase(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &item);
virtual void RenX_OnWeaponPurchase(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &weapon); virtual void RenX_OnWeaponPurchase(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &weapon);
virtual void RenX_OnRefillPurchase(Server *server, const PlayerInfo *player); virtual void RenX_OnRefillPurchase(Server &server, const PlayerInfo &player);
virtual void RenX_OnVehiclePurchase(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle); virtual void RenX_OnVehiclePurchase(Server &server, const PlayerInfo &owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnVehicleSpawn(Server *server, const TeamType &team, const Jupiter::ReadableString &vehicle); virtual void RenX_OnVehicleSpawn(Server &server, const TeamType &team, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnSpawn(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character); virtual void RenX_OnSpawn(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &character);
virtual void RenX_OnBotJoin(Server *server, const PlayerInfo *player); virtual void RenX_OnBotJoin(Server &server, const PlayerInfo &player);
virtual void RenX_OnVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle); virtual void RenX_OnVehicleCrate(Server &server, const PlayerInfo &owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnTSVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle); virtual void RenX_OnTSVehicleCrate(Server &server, const PlayerInfo &owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnRAVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle); virtual void RenX_OnRAVehicleCrate(Server &server, const PlayerInfo &owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnDeathCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnDeathCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnMoneyCrate(Server *server, const PlayerInfo *player, int amount); virtual void RenX_OnMoneyCrate(Server &server, const PlayerInfo &player, int amount);
virtual void RenX_OnCharacterCrate(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character); virtual void RenX_OnCharacterCrate(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &character);
virtual void RenX_OnSpyCrate(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character); virtual void RenX_OnSpyCrate(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &character);
virtual void RenX_OnRefillCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnRefillCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnTimeBombCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnTimeBombCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnSpeedCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnSpeedCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnNukeCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnNukeCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnAbductionCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnAbductionCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnUnspecifiedCrate(Server *server, const PlayerInfo *player); virtual void RenX_OnUnspecifiedCrate(Server &server, const PlayerInfo &player);
virtual void RenX_OnOtherCrate(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &type); virtual void RenX_OnOtherCrate(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &type);
virtual void RenX_OnSteal(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &vehicle); virtual void RenX_OnSteal(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnSteal(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &vehicle, const PlayerInfo *victim); virtual void RenX_OnSteal(Server &server, const PlayerInfo &player, const Jupiter::ReadableString &vehicle, const PlayerInfo &victim);
virtual void RenX_OnDonate(Server *server, const PlayerInfo *donor, const PlayerInfo *player, double amount); virtual void RenX_OnDonate(Server &server, const PlayerInfo &donor, const PlayerInfo &player, double amount);
virtual void RenX_OnGameOver(Server *server, WinType winType, const TeamType &team, int gScore, int nScore); virtual void RenX_OnGameOver(Server &server, WinType winType, const TeamType &team, int gScore, int nScore);
virtual void RenX_OnGame(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnGame(Server &server, const Jupiter::ReadableString &raw);
/** RCON type logs */ /** RCON type logs */
virtual void RenX_OnExecute(Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command); virtual void RenX_OnExecute(Server &server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command);
virtual void RenX_OnSubscribe(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnSubscribe(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnUnsubscribe(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnUnsubscribe(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnBlock(Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message); virtual void RenX_OnBlock(Server &server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message);
virtual void RenX_OnConnect(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnConnect(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnAuthenticate(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnAuthenticate(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnBan(Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message); virtual void RenX_OnBan(Server &server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message);
virtual void RenX_OnInvalidPassword(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnInvalidPassword(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnDrop(Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message); virtual void RenX_OnDrop(Server &server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &message);
virtual void RenX_OnDisconnect(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnDisconnect(Server &server, const Jupiter::ReadableString &user);
virtual void RenX_OnStopListen(Server *server, const Jupiter::ReadableString &message); virtual void RenX_OnStopListen(Server &server, const Jupiter::ReadableString &message);
virtual void RenX_OnResumeListen(Server *server, const Jupiter::ReadableString &message); virtual void RenX_OnResumeListen(Server &server, const Jupiter::ReadableString &message);
virtual void RenX_OnWarning(Server *server, const Jupiter::ReadableString &message); virtual void RenX_OnWarning(Server &server, const Jupiter::ReadableString &message);
virtual void RenX_OnRCON(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnRCON(Server &server, const Jupiter::ReadableString &raw);
/** Admin Type Logs */ /** Admin Type Logs */
virtual void RenX_OnAdminLogin(Server *server, const PlayerInfo *player); virtual void RenX_OnAdminLogin(Server &server, const PlayerInfo &player);
virtual void RenX_OnAdminGrant(Server *server, const PlayerInfo *player); virtual void RenX_OnAdminGrant(Server &server, const PlayerInfo &player);
virtual void RenX_OnAdminLogout(Server *server, const PlayerInfo *player); virtual void RenX_OnAdminLogout(Server &server, const PlayerInfo &player);
virtual void RenX_OnAdmin(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnAdmin(Server &server, const Jupiter::ReadableString &raw);
/** Vote Type Logs */ /** Vote Type Logs */
virtual void RenX_OnVoteAddBots(Server *server, const TeamType &team, const PlayerInfo *player, const TeamType &victim, int amount, int skill); 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_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_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_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_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_OnVoteRestartMap(Server &server, const TeamType &team, const PlayerInfo &player);
virtual void RenX_OnVoteSurrender(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_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_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_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_OnVoteCancel(Server &server, const TeamType &team, const Jupiter::ReadableString &type);
virtual void RenX_OnVote(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnVote(Server &server, const Jupiter::ReadableString &raw);
/** Map Type Logs */ /** Map Type Logs */
virtual void RenX_OnMapChange(Server *server, const Jupiter::ReadableString &map, bool seamless); virtual void RenX_OnMapChange(Server &server, const Jupiter::ReadableString &map, bool seamless);
virtual void RenX_OnMapLoad(Server *server, const Jupiter::ReadableString &map); virtual void RenX_OnMapLoad(Server &server, const Jupiter::ReadableString &map);
virtual void RenX_OnMapStart(Server *server, const Jupiter::ReadableString &map); virtual void RenX_OnMapStart(Server &server, const Jupiter::ReadableString &map);
virtual void RenX_OnMap(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnMap(Server &server, const Jupiter::ReadableString &raw);
/** Demo Type Logs */ /** Demo Type Logs */
virtual void RenX_OnDemoRecord(Server *server, const PlayerInfo *player); virtual void RenX_OnDemoRecord(Server &server, const PlayerInfo &player);
virtual void RenX_OnDemoRecord(Server *server, const Jupiter::ReadableString &user); // Note: user is currently always empty. virtual void RenX_OnDemoRecord(Server &server, const Jupiter::ReadableString &user); // Note: user is currently always empty.
virtual void RenX_OnDemoRecordStop(Server *server); virtual void RenX_OnDemoRecordStop(Server &server);
virtual void RenX_OnDemo(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnDemo(Server &server, const Jupiter::ReadableString &raw);
/** Other Logs */ /** Other Logs */
virtual void RenX_OnLog(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnLog(Server &server, const Jupiter::ReadableString &raw);
/** Command type */ /** Command type */
virtual void RenX_OnCommand(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnCommand(Server &server, const Jupiter::ReadableString &raw);
/** Error type */ /** Error type */
virtual void RenX_OnError(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnError(Server &server, const Jupiter::ReadableString &raw);
/** Version type */ /** Version type */
virtual void RenX_OnVersion(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnVersion(Server &server, const Jupiter::ReadableString &raw);
/** Authorized type */ /** Authorized type */
virtual void RenX_OnAuthorized(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnAuthorized(Server &server, const Jupiter::ReadableString &raw);
/** Other type - executed if none of the above matched */ /** Other type - executed if none of the above matched */
virtual void RenX_OnOther(Server *server, const char token, const Jupiter::ReadableString &raw); virtual void RenX_OnOther(Server &server, const char token, const Jupiter::ReadableString &raw);
/** Catch-all - always executes for every line from RCON */ /** Catch-all - always executes for every line from RCON */
virtual void RenX_OnRaw(Server *server, const Jupiter::ReadableString &raw); virtual void RenX_OnRaw(Server &server, const Jupiter::ReadableString &raw);
/** /**
* @brief Default constructor for the Plugin class. * @brief Default constructor for the Plugin class.

628
RenX.Core/RenX_Server.cpp

File diff suppressed because it is too large

47
RenX.Core/RenX_Server.h

@ -24,10 +24,9 @@
* @brief Defines the Server class. * @brief Defines the Server class.
*/ */
#include <ctime>
#include <chrono> #include <chrono>
#include <list>
#include "Jupiter/TCPSocket.h" #include "Jupiter/TCPSocket.h"
#include "Jupiter/DLList.h"
#include "Jupiter/ArrayList.h" #include "Jupiter/ArrayList.h"
#include "Jupiter/String.h" #include "Jupiter/String.h"
#include "Jupiter/CString.h" #include "Jupiter/CString.h"
@ -84,7 +83,7 @@ namespace RenX
virtual bool OnBadRehash(bool removed); virtual bool OnBadRehash(bool removed);
public: // RenX::Server public: // RenX::Server
Jupiter::DLList<RenX::PlayerInfo> players; /** A list of players in the server */ std::list<RenX::PlayerInfo> players; /** A list of players in the server */
Jupiter::ArrayList<RenX::BuildingInfo> buildings; /** A list of buildings in the server */ Jupiter::ArrayList<RenX::BuildingInfo> buildings; /** A list of buildings in the server */
Jupiter::ArrayList<Jupiter::StringS> mutators; /** A list of buildings the server is running */ Jupiter::ArrayList<Jupiter::StringS> mutators; /** A list of buildings the server is running */
Jupiter::ArrayList<RenX::Map> maps; /** A list of maps in the server's rotation */ Jupiter::ArrayList<RenX::Map> maps; /** A list of maps in the server's rotation */
@ -244,7 +243,7 @@ namespace RenX
* @param message Message to send in-game. * @param message Message to send in-game.
* @return The number of bytes sent on success, less than or equal to zero otherwise. * @return The number of bytes sent on success, less than or equal to zero otherwise.
*/ */
int sendMessage(const RenX::PlayerInfo *player, const Jupiter::ReadableString &message); int sendMessage(const RenX::PlayerInfo &player, const Jupiter::ReadableString &message);
/** /**
* @brief Sends data to the server. * @brief Sends data to the server.
@ -307,7 +306,7 @@ namespace RenX
* @param player Player to calculate game-time of. * @param player Player to calculate game-time of.
* @return Time player has been playing. * @return Time player has been playing.
*/ */
std::chrono::milliseconds getGameTime(const RenX::PlayerInfo *player) const; std::chrono::milliseconds getGameTime(const RenX::PlayerInfo &player) const;
/** /**
* @brief Fetches the number of bots in the server. * @brief Fetches the number of bots in the server.
@ -355,7 +354,7 @@ namespace RenX
* @param player Player to fetch Steam ID from * @param player Player to fetch Steam ID from
* @return A player's formatted Steam ID on success, an empty string otherwise. * @return A player's formatted Steam ID on success, an empty string otherwise.
*/ */
Jupiter::StringS formatSteamID(const RenX::PlayerInfo *player) const; Jupiter::StringS formatSteamID(const RenX::PlayerInfo &player) const;
/** /**
* @brief Formats a Steam ID into a readable string. * @brief Formats a Steam ID into a readable string.
@ -377,7 +376,7 @@ namespace RenX
* *
* @param player Data of the player to kick. * @param player Data of the player to kick.
*/ */
void kickPlayer(const RenX::PlayerInfo *player, const Jupiter::ReadableString &reason); void kickPlayer(const RenX::PlayerInfo &player, const Jupiter::ReadableString &reason);
/** /**
* @brief Kicks a player from the server. * @brief Kicks a player from the server.
@ -391,7 +390,7 @@ namespace RenX
* *
* @param player Data of the player to kick. * @param player Data of the player to kick.
*/ */
void forceKickPlayer(const RenX::PlayerInfo *player, const Jupiter::ReadableString &reason); void forceKickPlayer(const RenX::PlayerInfo &player, const Jupiter::ReadableString &reason);
/** /**
* @brief Checks if any players are in the ban list, and kicks any players listed. * @brief Checks if any players are in the ban list, and kicks any players listed.
@ -404,7 +403,7 @@ namespace RenX
* *
* @param player Data of the player to check. * @param player Data of the player to check.
*/ */
void banCheck(RenX::PlayerInfo *player); void banCheck(RenX::PlayerInfo &player);
/** /**
* @brief Bans a player from the server. * @brief Bans a player from the server.
@ -419,7 +418,7 @@ namespace RenX
* @param player Data of the player to ban. * @param player Data of the player to ban.
* @param length Duration of the ban (0 for permanent). * @param length Duration of the ban (0 for permanent).
*/ */
void banPlayer(const RenX::PlayerInfo *player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length = std::chrono::seconds::zero()); void banPlayer(const RenX::PlayerInfo &player, const Jupiter::ReadableString &banner, const Jupiter::ReadableString &reason, std::chrono::seconds length = std::chrono::seconds::zero());
/** /**
* @brief Removes a player's data based on their ID number. * @brief Removes a player's data based on their ID number.
@ -435,7 +434,7 @@ namespace RenX
* @param player Pointer to a player's data * @param player Pointer to a player's data
* @return True if a player was removed, false otherwise. * @return True if a player was removed, false otherwise.
*/ */
bool removePlayer(RenX::PlayerInfo *player); bool removePlayer(RenX::PlayerInfo &player);
/** /**
* @brief Sends a full client list request. * @brief Sends a full client list request.
@ -533,14 +532,14 @@ namespace RenX
* *
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool mute(const RenX::PlayerInfo *player); bool mute(const RenX::PlayerInfo &player);
/** /**
* @brief Allows a player to use the game chat. * @brief Allows a player to use the game chat.
* *
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool unmute(const RenX::PlayerInfo *player); bool unmute(const RenX::PlayerInfo &player);
/** /**
* @brief Gives a player additional credits. * @brief Gives a player additional credits.
@ -558,7 +557,7 @@ namespace RenX
* @param credits Credits to give to player * @param credits Credits to give to player
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool giveCredits(RenX::PlayerInfo *player, double credits); bool giveCredits(RenX::PlayerInfo &player, double credits);
/** /**
* @brief Kills a player. * @brief Kills a player.
@ -574,7 +573,7 @@ namespace RenX
* @param player Player to kill * @param player Player to kill
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool kill(RenX::PlayerInfo *player); bool kill(RenX::PlayerInfo &player);
/** /**
* @brief Disarms all of a player's deployed objects. * @brief Disarms all of a player's deployed objects.
@ -590,7 +589,7 @@ namespace RenX
* @param player Player to disarm * @param player Player to disarm
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool disarm(RenX::PlayerInfo *player); bool disarm(RenX::PlayerInfo &player);
/** /**
* @brief Disarms all of a player's deployed C4. * @brief Disarms all of a player's deployed C4.
@ -606,7 +605,7 @@ namespace RenX
* @param player Player to disarm * @param player Player to disarm
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool disarmC4(RenX::PlayerInfo *player); bool disarmC4(RenX::PlayerInfo &player);
/** /**
* @brief Disarms all of a player's deployed beacons. * @brief Disarms all of a player's deployed beacons.
@ -622,7 +621,7 @@ namespace RenX
* @param player Player to disarm * @param player Player to disarm
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool disarmBeacon(RenX::PlayerInfo *player); bool disarmBeacon(RenX::PlayerInfo &player);
/** /**
* @brief Bans a player from mining in-game for 1 game (or until they disconnect). * @brief Bans a player from mining in-game for 1 game (or until they disconnect).
@ -638,7 +637,7 @@ namespace RenX
* @param player Player to mine-ban * @param player Player to mine-ban
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool mineBan(RenX::PlayerInfo *player); bool mineBan(RenX::PlayerInfo &player);
/** /**
* @brief Forces a player to change teams. * @brief Forces a player to change teams.
@ -656,7 +655,7 @@ namespace RenX
* @param resetCredits True to reset the player's credits, false otherwise. * @param resetCredits True to reset the player's credits, false otherwise.
* @return True on success, false otherwise. * @return True on success, false otherwise.
*/ */
bool changeTeam(RenX::PlayerInfo *player, bool resetCredits = true); bool changeTeam(RenX::PlayerInfo &player, bool resetCredits = true);
/** /**
* @brief Fetches a server's IRC logging prefix. * @brief Fetches a server's IRC logging prefix.
@ -825,7 +824,7 @@ namespace RenX
* @param parameters Parameters to pass to the command * @param parameters Parameters to pass to the command
* @return Command executed if a match is found, nullptr otherwise. * @return Command executed if a match is found, nullptr otherwise.
*/ */
RenX::GameCommand *triggerCommand(const Jupiter::ReadableString &trigger, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters); RenX::GameCommand *triggerCommand(const Jupiter::ReadableString &trigger, RenX::PlayerInfo &player, const Jupiter::ReadableString &parameters);
/** /**
* @brief Adds a command to the server's game command list. * @brief Adds a command to the server's game command list.
@ -857,7 +856,7 @@ namespace RenX
* @param player Player to calculate UUID of * @param player Player to calculate UUID of
* @return UUID calculated from player. * @return UUID calculated from player.
*/ */
typedef Jupiter::StringS(*uuid_func)(RenX::PlayerInfo *player); typedef Jupiter::StringS(*uuid_func)(RenX::PlayerInfo &player);
/** /**
* @brief Sets the player UUID calculation function. * @brief Sets the player UUID calculation function.
@ -880,7 +879,7 @@ namespace RenX
* @param player Player with UUID to change * @param player Player with UUID to change
* @param uuid Player's new UUID * @param uuid Player's new UUID
*/ */
void setUUID(RenX::PlayerInfo *player, const Jupiter::ReadableString &uuid); void setUUID(RenX::PlayerInfo &player, const Jupiter::ReadableString &uuid);
/** /**
* @brief Changes a player's UUID only if it is different than their current UUID * @brief Changes a player's UUID only if it is different than their current UUID
@ -889,7 +888,7 @@ namespace RenX
* @param uuid Player's new UUID * @param uuid Player's new UUID
* @return True if the UUIDs did not match, false otherwise. * @return True if the UUIDs did not match, false otherwise.
*/ */
bool setUUIDIfDifferent(RenX::PlayerInfo *player, const Jupiter::ReadableString &uuid); bool setUUIDIfDifferent(RenX::PlayerInfo &player, const Jupiter::ReadableString &uuid);
/** /**
* @brief Checks if reverse DNS resolution is occuring for players. * @brief Checks if reverse DNS resolution is occuring for players.

10
RenX.Core/RenX_Tags.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -464,16 +464,16 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
PROCESS_TAG(this->INTERNAL_SERVER_PREFIX_TAG, server->getPrefix()); PROCESS_TAG(this->INTERNAL_SERVER_PREFIX_TAG, server->getPrefix());
if (player != nullptr) if (player != nullptr)
{ {
PROCESS_TAG(this->INTERNAL_STEAM_TAG, server->formatSteamID(player)); PROCESS_TAG(this->INTERNAL_STEAM_TAG, server->formatSteamID(*player));
} }
if (victim != nullptr) if (victim != nullptr)
{ {
PROCESS_TAG(this->INTERNAL_VICTIM_STEAM_TAG, server->formatSteamID(victim)); PROCESS_TAG(this->INTERNAL_VICTIM_STEAM_TAG, server->formatSteamID(*victim));
} }
} }
if (player != nullptr) if (player != nullptr)
{ {
PROCESS_TAG(this->INTERNAL_NAME_TAG, RenX::getFormattedPlayerName(player)); PROCESS_TAG(this->INTERNAL_NAME_TAG, RenX::getFormattedPlayerName(*player));
PROCESS_TAG(this->INTERNAL_RAW_NAME_TAG, player->name); PROCESS_TAG(this->INTERNAL_RAW_NAME_TAG, player->name);
PROCESS_TAG(this->INTERNAL_IP_TAG, player->ip); PROCESS_TAG(this->INTERNAL_IP_TAG, player->ip);
PROCESS_TAG(this->INTERNAL_HWID_TAG, player->hwid); PROCESS_TAG(this->INTERNAL_HWID_TAG, player->hwid);
@ -519,7 +519,7 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
} }
if (victim != nullptr) if (victim != nullptr)
{ {
PROCESS_TAG(this->INTERNAL_VICTIM_NAME_TAG, RenX::getFormattedPlayerName(victim)); PROCESS_TAG(this->INTERNAL_VICTIM_NAME_TAG, RenX::getFormattedPlayerName(*victim));
PROCESS_TAG(this->INTERNAL_VICTIM_RAW_NAME_TAG, victim->name); PROCESS_TAG(this->INTERNAL_VICTIM_RAW_NAME_TAG, victim->name);
PROCESS_TAG(this->INTERNAL_VICTIM_IP_TAG, victim->ip); PROCESS_TAG(this->INTERNAL_VICTIM_IP_TAG, victim->ip);
PROCESS_TAG(this->INTERNAL_VICTIM_HWID_TAG, victim->hwid); PROCESS_TAG(this->INTERNAL_VICTIM_HWID_TAG, victim->hwid);

22
RenX.ExcessiveHeadshots/ExcessiveHeadshots.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -41,15 +41,17 @@ int RenX_ExcessiveHeadshotsPlugin::OnRehash()
return this->initialize() ? 0 : -1; return this->initialize() ? 0 : -1;
} }
void RenX_ExcessiveHeadshotsPlugin::RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) void RenX_ExcessiveHeadshotsPlugin::RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType)
{ {
if (player->kills < 3) return; if (player.kills < 3)
return;
if (damageType.equals("Rx_DmgType_Headshot"_jrs)) if (damageType.equals("Rx_DmgType_Headshot"_jrs))
{ {
unsigned int flags = 0; unsigned int flags = 0;
std::chrono::milliseconds game_time = server->getGameTime(player); std::chrono::milliseconds game_time = server.getGameTime(player);
double kps = game_time == std::chrono::milliseconds::zero() ? static_cast<double>(player->kills) : static_cast<double>(player->kills) / static_cast<double>(game_time.count()); double kps = game_time == std::chrono::milliseconds::zero() ? static_cast<double>(player.kills) : static_cast<double>(player.kills) / static_cast<double>(game_time.count());
if (player->kills >= RenX_ExcessiveHeadshotsPlugin::minKills) flags++; if (player.kills >= RenX_ExcessiveHeadshotsPlugin::minKills) flags++;
if (RenX::getHeadshotKillRatio(player) >= RenX_ExcessiveHeadshotsPlugin::ratio) flags++; if (RenX::getHeadshotKillRatio(player) >= RenX_ExcessiveHeadshotsPlugin::ratio) flags++;
if (RenX::getKillDeathRatio(player) >= RenX_ExcessiveHeadshotsPlugin::minKD) flags++; if (RenX::getKillDeathRatio(player) >= RenX_ExcessiveHeadshotsPlugin::minKD) flags++;
if (kps >= RenX_ExcessiveHeadshotsPlugin::minKPS) flags++; if (kps >= RenX_ExcessiveHeadshotsPlugin::minKPS) flags++;
@ -58,10 +60,10 @@ void RenX_ExcessiveHeadshotsPlugin::RenX_OnKill(RenX::Server *server, const RenX
if (flags >= RenX_ExcessiveHeadshotsPlugin::minFlags) if (flags >= RenX_ExcessiveHeadshotsPlugin::minFlags)
{ {
server->banPlayer(player, "Jupiter Bot"_jrs, "Aimbot detected"_jrs); server.banPlayer(player, "Jupiter Bot"_jrs, "Aimbot detected"_jrs);
server->sendPubChan(IRCCOLOR "13[Aimbot]" IRCCOLOR " %.*s was banned from the server! Kills: %u - Deaths: %u - Headshots: %u", player->name.size(), player->name.ptr(), player->kills, player->deaths, player->headshots); server.sendPubChan(IRCCOLOR "13[Aimbot]" IRCCOLOR " %.*s was banned from the server! Kills: %u - Deaths: %u - Headshots: %u", player.name.size(), player.name.ptr(), player.kills, player.deaths, player.headshots);
const Jupiter::ReadableString &steamid = server->formatSteamID(player); const Jupiter::ReadableString &steamid = server.formatSteamID(player);
server->sendAdmChan(IRCCOLOR "13[Aimbot]" IRCCOLOR " %.*s was banned from the server! Kills: %u - Deaths: %u - Headshots: %u - IP: " IRCBOLD "%.*s" IRCBOLD " - Steam ID: " IRCBOLD "%.*s" IRCBOLD, player->name.size(), player->name.ptr(), player->kills, player->deaths, player->headshots, player->ip.size(), player->ip.ptr(), steamid.size(), steamid.ptr()); server.sendAdmChan(IRCCOLOR "13[Aimbot]" IRCCOLOR " %.*s was banned from the server! Kills: %u - Deaths: %u - Headshots: %u - IP: " IRCBOLD "%.*s" IRCBOLD " - Steam ID: " IRCBOLD "%.*s" IRCBOLD, player.name.size(), player.name.ptr(), player.kills, player.deaths, player.headshots, player.ip.size(), player.ip.ptr(), steamid.size(), steamid.ptr());
} }
} }
} }

4
RenX.ExcessiveHeadshots/ExcessiveHeadshots.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_ExcessiveHeadshotsPlugin : public RenX::Plugin class RenX_ExcessiveHeadshotsPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
virtual bool initialize() override; virtual bool initialize() override;

8
RenX.ExtraLogging/RenX_ExtraLogging.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -88,14 +88,14 @@ int RenX_ExtraLoggingPlugin::think()
return 0; return 0;
} }
void RenX_ExtraLoggingPlugin::RenX_OnRaw(RenX::Server *server, const Jupiter::ReadableString &raw) void RenX_ExtraLoggingPlugin::RenX_OnRaw(RenX::Server &server, const Jupiter::ReadableString &raw)
{ {
if (RenX_ExtraLoggingPlugin::printToConsole) if (RenX_ExtraLoggingPlugin::printToConsole)
{ {
if (RenX_ExtraLoggingPlugin::filePrefix.isNotEmpty()) if (RenX_ExtraLoggingPlugin::filePrefix.isNotEmpty())
{ {
Jupiter::StringS cPrefix = RenX_ExtraLoggingPlugin::filePrefix; Jupiter::StringS cPrefix = RenX_ExtraLoggingPlugin::filePrefix;
RenX::processTags(cPrefix, server); RenX::processTags(cPrefix, &server);
cPrefix.print(stdout); cPrefix.print(stdout);
fputc(' ', stdout); fputc(' ', stdout);
} }
@ -107,7 +107,7 @@ void RenX_ExtraLoggingPlugin::RenX_OnRaw(RenX::Server *server, const Jupiter::Re
if (RenX_ExtraLoggingPlugin::filePrefix.isNotEmpty()) if (RenX_ExtraLoggingPlugin::filePrefix.isNotEmpty())
{ {
Jupiter::StringS fPrefix = RenX_ExtraLoggingPlugin::filePrefix; Jupiter::StringS fPrefix = RenX_ExtraLoggingPlugin::filePrefix;
RenX::processTags(fPrefix, server); RenX::processTags(fPrefix, &server);
fPrefix.print(RenX_ExtraLoggingPlugin::file); fPrefix.print(RenX_ExtraLoggingPlugin::file);
fputc(' ', RenX_ExtraLoggingPlugin::file); fputc(' ', RenX_ExtraLoggingPlugin::file);
} }

4
RenX.ExtraLogging/RenX_ExtraLogging.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_ExtraLoggingPlugin : public RenX::Plugin class RenX_ExtraLoggingPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
virtual void RenX_OnRaw(RenX::Server *server, const Jupiter::ReadableString &raw) override; virtual void RenX_OnRaw(RenX::Server &server, const Jupiter::ReadableString &raw) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
virtual bool initialize() override; virtual bool initialize() override;

12
RenX.Greetings/RenX_Greetings.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2015 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -24,21 +24,21 @@
using namespace Jupiter::literals; using namespace Jupiter::literals;
void RenX_GreetingsPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_GreetingsPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
auto sendMessage = [&](const Jupiter::ReadableString &m) auto sendMessage = [&](const Jupiter::ReadableString &m)
{ {
Jupiter::String msg = m; Jupiter::String msg = m;
RenX::sanitizeTags(msg); RenX::sanitizeTags(msg);
RenX::processTags(msg, server, player); RenX::processTags(msg, &server, &player);
if (this->sendPrivate) if (this->sendPrivate)
server->sendMessage(player, msg); server.sendMessage(player, msg);
else else
server->sendMessage(msg); server.sendMessage(msg);
}; };
if (player->isBot == false && server->isMatchInProgress()) if (player.isBot == false && server.isMatchInProgress())
{ {
switch (RenX_GreetingsPlugin::sendMode) switch (RenX_GreetingsPlugin::sendMode)
{ {

4
RenX.Greetings/RenX_Greetings.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -28,7 +28,7 @@
class RenX_GreetingsPlugin : public RenX::Plugin class RenX_GreetingsPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
virtual bool initialize() override; virtual bool initialize() override;

16
RenX.HybridUUID/RenX_HybridUUID.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -23,11 +23,13 @@
#include "RenX_Functions.h" #include "RenX_Functions.h"
#include "RenX_HybridUUID.h" #include "RenX_HybridUUID.h"
Jupiter::StringS calc_uuid(RenX::PlayerInfo *player) using namespace Jupiter::literals;
Jupiter::StringS calc_uuid(RenX::PlayerInfo &player)
{ {
if (player->steamid != 0U) if (player.steamid != 0U)
return Jupiter::StringS::Format("S%.16llX", player->steamid); return Jupiter::StringS::Format("S%.16llX", player.steamid);
return Jupiter::StringS::Format("N%.*s", player->name.size(), player->name.ptr()); return "N"_jrs + player.name;
} }
RenX_HybridUUIDPlugin::RenX_HybridUUIDPlugin() RenX_HybridUUIDPlugin::RenX_HybridUUIDPlugin()
@ -46,9 +48,9 @@ RenX_HybridUUIDPlugin::~RenX_HybridUUIDPlugin()
core.getServer(--index)->setUUIDFunction(RenX::default_uuid_func); core.getServer(--index)->setUUIDFunction(RenX::default_uuid_func);
} }
void RenX_HybridUUIDPlugin::RenX_OnServerCreate(RenX::Server *server) void RenX_HybridUUIDPlugin::RenX_OnServerCreate(RenX::Server &server)
{ {
server->setUUIDFunction(calc_uuid); server.setUUIDFunction(calc_uuid);
} }
// Plugin instantiation and entry point. // Plugin instantiation and entry point.

4
RenX.HybridUUID/RenX_HybridUUID.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_HybridUUIDPlugin : public RenX::Plugin class RenX_HybridUUIDPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnServerCreate(RenX::Server *server) override; void RenX_OnServerCreate(RenX::Server &server) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
RenX_HybridUUIDPlugin(); RenX_HybridUUIDPlugin();

4
RenX.Ladder.Daily/RenX_Ladder_Daily.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -42,7 +42,7 @@ bool RenX_Ladder_Daily_TimePlugin::initialize()
// Plugin instantiation and entry point. // Plugin instantiation and entry point.
RenX_Ladder_Daily_TimePlugin pluginInstance; RenX_Ladder_Daily_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0)));
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday) if (pluginInstance.last_sorted_day != tm_ptr->tm_wday)

4
RenX.Ladder.Daily/RenX_Ladder_Daily.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -34,6 +34,6 @@ private:
RenX::LadderDatabase database; RenX::LadderDatabase database;
}; };
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team); void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &server, const RenX::TeamType &team);
#endif // _RENX_LADDER_ALL_TIME #endif // _RENX_LADDER_ALL_TIME

4
RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -42,7 +42,7 @@ bool RenX_Ladder_Monthly_TimePlugin::initialize()
// Plugin instantiation and entry point. // Plugin instantiation and entry point.
RenX_Ladder_Monthly_TimePlugin pluginInstance; RenX_Ladder_Monthly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0)));
if (pluginInstance.last_sorted_month != tm_ptr->tm_mon) if (pluginInstance.last_sorted_month != tm_ptr->tm_mon)

4
RenX.Ladder.Monthly/RenX_Ladder_Monthly.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -34,6 +34,6 @@ private:
RenX::LadderDatabase database; RenX::LadderDatabase database;
}; };
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team); void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &server, const RenX::TeamType &team);
#endif // _RENX_LADDER_ALL_TIME #endif // _RENX_LADDER_ALL_TIME

4
RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -43,7 +43,7 @@ bool RenX_Ladder_Weekly_TimePlugin::initialize()
// Plugin instantiation and entry point. // Plugin instantiation and entry point.
RenX_Ladder_Weekly_TimePlugin pluginInstance; RenX_Ladder_Weekly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0)));
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday && tm_ptr->tm_wday == pluginInstance.reset_day) if (pluginInstance.last_sorted_day != tm_ptr->tm_wday && tm_ptr->tm_wday == pluginInstance.reset_day)

4
RenX.Ladder.Weekly/RenX_Ladder_Weekly.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -35,6 +35,6 @@ private:
RenX::LadderDatabase database; RenX::LadderDatabase database;
}; };
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team); void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &server, const RenX::TeamType &team);
#endif // _RENX_LADDER_ALL_TIME #endif // _RENX_LADDER_ALL_TIME

4
RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -42,7 +42,7 @@ bool RenX_Ladder_Yearly_TimePlugin::initialize()
// Plugin instantiation and entry point. // Plugin instantiation and entry point.
RenX_Ladder_Yearly_TimePlugin pluginInstance; RenX_Ladder_Yearly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0)));
if (pluginInstance.last_sorted_year != tm_ptr->tm_year) if (pluginInstance.last_sorted_year != tm_ptr->tm_year)

4
RenX.Ladder.Yearly/RenX_Ladder_Yearly.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -34,6 +34,6 @@ private:
RenX::LadderDatabase database; RenX::LadderDatabase database;
}; };
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server *server, const RenX::TeamType &team); void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &server, const RenX::TeamType &team);
#endif // _RENX_LADDER_ALL_TIME #endif // _RENX_LADDER_ALL_TIME

34
RenX.Ladder/RenX_Ladder.cpp

@ -45,33 +45,33 @@ bool RenX_LadderPlugin::initialize()
return true; return true;
} }
void RenX_LadderPlugin::RenX_OnServerFullyConnected(RenX::Server *server) void RenX_LadderPlugin::RenX_OnServerFullyConnected(RenX::Server &server)
{ {
if (this->only_pure == false || server->isPure()) if (this->only_pure == false || server.isPure())
server->setRanked(true); server.setRanked(true);
} }
/** Wait until the client list has been updated to update the ladder */ /** Wait until the client list has been updated to update the ladder */
void RenX_LadderPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) void RenX_LadderPlugin::RenX_OnGameOver(RenX::Server &server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore)
{ {
if (server->isRanked() && server->isReliable() && server->players.size() != server->getBotCount()) if (server.isRanked() && server.isReliable() && server.players.size() != server.getBotCount())
{ {
char chr = static_cast<char>(team); char chr = static_cast<char>(team);
server->varData[this->name].set("t"_jrs, Jupiter::ReferenceString(&chr, 1)); server.varData[this->name].set("t"_jrs, Jupiter::ReferenceString(&chr, 1));
server->varData[this->name].set("w"_jrs, "1"_jrs); server.varData[this->name].set("w"_jrs, "1"_jrs);
server->updateClientList(); server.updateClientList();
} }
} }
void RenX_LadderPlugin::RenX_OnCommand(RenX::Server *server, const Jupiter::ReadableString &) void RenX_LadderPlugin::RenX_OnCommand(RenX::Server &server, const Jupiter::ReadableString &)
{ {
if (server->getCurrentRCONCommand().equalsi("clientvarlist"_jrs)) if (server.getCurrentRCONCommand().equalsi("clientvarlist"_jrs))
{ {
if (server->varData[this->name].get("w"_jrs, "0"_jrs).equals("1")) if (server.varData[this->name].get("w"_jrs, "0"_jrs).equals("1"))
{ {
server->varData[this->name].set("w"_jrs, "0"_jrs); server.varData[this->name].set("w"_jrs, "0"_jrs);
RenX::TeamType team = static_cast<RenX::TeamType>(server->varData[this->name].get("t"_jrs, "\0"_jrs).get(0)); RenX::TeamType team = static_cast<RenX::TeamType>(server.varData[this->name].get("t"_jrs, "\0"_jrs).get(0));
for (size_t index = 0; index != RenX::ladder_databases.size(); ++index) for (size_t index = 0; index != RenX::ladder_databases.size(); ++index)
RenX::ladder_databases.get(index)->updateLadder(server, team); RenX::ladder_databases.get(index)->updateLadder(server, team);
} }
@ -172,13 +172,13 @@ void LadderGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (pair.first != nullptr) if (pair.first != nullptr)
source->sendMessage(FormatLadderResponse(pair.first, pair.second + 1)); source->sendMessage(FormatLadderResponse(pair.first, pair.second + 1));
else else
source->sendMessage(player, "Error: You have no ladder data. Get started by sticking around until the end of the match!"_jrs); source->sendMessage(*player, "Error: You have no ladder data. Get started by sticking around until the end of the match!"_jrs);
} }
else else
source->sendMessage(player, "Error: No default ladder database specified."_jrs); source->sendMessage(*player, "Error: No default ladder database specified."_jrs);
} }
else else
source->sendMessage(player, "Error: You have no ladder data, because you're not using Steam."_jrs); source->sendMessage(*player, "Error: You have no ladder data, because you're not using Steam."_jrs);
} }
else else
{ {
@ -186,7 +186,7 @@ void LadderGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
Jupiter::GenericCommand::ResponseLine *ptr; Jupiter::GenericCommand::ResponseLine *ptr;
while (response != nullptr) while (response != nullptr)
{ {
source->sendMessage(player, response->response); source->sendMessage(*player, response->response);
ptr = response; ptr = response;
response = response->next; response = response->next;
delete ptr; delete ptr;

8
RenX.Ladder/RenX_Ladder.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -36,9 +36,9 @@ class RenX_LadderPlugin : public RenX::Plugin
{ {
public: public:
virtual bool initialize() override; virtual bool initialize() override;
void RenX_OnServerFullyConnected(RenX::Server *server) override; void RenX_OnServerFullyConnected(RenX::Server &server) override;
void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override; void RenX_OnGameOver(RenX::Server &server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override;
void RenX_OnCommand(RenX::Server *server, const Jupiter::ReadableString &) override; void RenX_OnCommand(RenX::Server &server, const Jupiter::ReadableString &) override;
size_t getMaxLadderCommandPartNameOutput() const; size_t getMaxLadderCommandPartNameOutput() const;

572
RenX.Logging/RenX_Logging.cpp

File diff suppressed because it is too large

186
RenX.Logging/RenX_Logging.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -25,108 +25,108 @@
class RenX_LoggingPlugin : public RenX::Plugin class RenX_LoggingPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnPlayerRDNS(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerRDNS(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPlayerIdentify(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerIdentify(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnKick(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &reason) override; void RenX_OnKick(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &reason) override;
void RenX_OnNameChange(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &newPlayerName) override; void RenX_OnNameChange(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &newPlayerName) override;
void RenX_OnTeamChange(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::TeamType &oldTeam) override; void RenX_OnTeamChange(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::TeamType &oldTeam) override;
void RenX_OnExecute(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &command) override; void RenX_OnExecute(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &command) override;
void RenX_OnPlayerCommand(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message, RenX::GameCommand *command) override; void RenX_OnPlayerCommand(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &message, RenX::GameCommand *command) override;
void RenX_OnSpeedHack(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnSpeedHack(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPlayer(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnPlayer(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnChat(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &message) override;
void RenX_OnTeamChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnTeamChat(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &message) override;
void RenX_OnRadioChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnRadioChat(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &message) override;
void RenX_OnHostChat(RenX::Server *server, const Jupiter::ReadableString &message) override; void RenX_OnHostChat(RenX::Server &server, const Jupiter::ReadableString &message) override;
void RenX_OnHostPage(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnHostPage(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &message) override;
void RenX_OnOtherChat(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnOtherChat(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnDeploy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) override; void RenX_OnDeploy(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &object) override;
void RenX_OnOverMine(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &location) override; void RenX_OnOverMine(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &location) override;
void RenX_OnDisarm(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object, const RenX::PlayerInfo *victim) override; void RenX_OnDisarm(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &object, const RenX::PlayerInfo &victim) override;
void RenX_OnDisarm(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) override; void RenX_OnDisarm(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &object) override;
void RenX_OnExplode(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) override; void RenX_OnExplode(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &object) override;
void RenX_OnExplode(RenX::Server *server, const Jupiter::ReadableString &object) override; void RenX_OnExplode(RenX::Server &server, const Jupiter::ReadableString &object) override;
void RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
void RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
void RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
void RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
void RenX_OnDie(RenX::Server *server, const Jupiter::ReadableString &object, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType) override; void RenX_OnDie(RenX::Server &server, const Jupiter::ReadableString &object, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType) override;
void RenX_OnDestroy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; void RenX_OnDestroy(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override;
void RenX_OnDestroy(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; void RenX_OnDestroy(RenX::Server &server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override;
void RenX_OnCapture(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override; void RenX_OnCapture(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override;
void RenX_OnNeutralize(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override; void RenX_OnNeutralize(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override;
void RenX_OnCharacterPurchase(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override; void RenX_OnCharacterPurchase(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &character) override;
void RenX_OnItemPurchase(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &item) override; void RenX_OnItemPurchase(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &item) override;
void RenX_OnWeaponPurchase(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &weapon) override; void RenX_OnWeaponPurchase(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &weapon) override;
void RenX_OnRefillPurchase(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnRefillPurchase(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnVehiclePurchase(RenX::Server *server, const RenX::PlayerInfo *owner, const Jupiter::ReadableString &vehicle) override; void RenX_OnVehiclePurchase(RenX::Server &server, const RenX::PlayerInfo &owner, const Jupiter::ReadableString &vehicle) override;
void RenX_OnVehicleSpawn(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &vehicle) override; void RenX_OnVehicleSpawn(RenX::Server &server, const RenX::TeamType &team, const Jupiter::ReadableString &vehicle) override;
void RenX_OnSpawn(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override; void RenX_OnSpawn(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &character) override;
void RenX_OnBotJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnBotJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override; void RenX_OnVehicleCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnTSVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override; void RenX_OnTSVehicleCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnRAVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override; void RenX_OnRAVehicleCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnDeathCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnDeathCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnMoneyCrate(RenX::Server *server, const RenX::PlayerInfo *player, int amount) override; void RenX_OnMoneyCrate(RenX::Server &server, const RenX::PlayerInfo &player, int amount) override;
void RenX_OnCharacterCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override; void RenX_OnCharacterCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &character) override;
void RenX_OnSpyCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override; void RenX_OnSpyCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &character) override;
void RenX_OnRefillCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnRefillCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnTimeBombCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnTimeBombCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnSpeedCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnSpeedCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnNukeCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnNukeCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAbductionCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAbductionCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnUnspecifiedCrate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnUnspecifiedCrate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnOtherCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &type) override; void RenX_OnOtherCrate(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &type) override;
void RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override; void RenX_OnSteal(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle, const RenX::PlayerInfo *victim) override; void RenX_OnSteal(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &vehicle, const RenX::PlayerInfo &victim) override;
void RenX_OnDonate(RenX::Server *server, const RenX::PlayerInfo *donor, const RenX::PlayerInfo *player, double amount) override; void RenX_OnDonate(RenX::Server &server, const RenX::PlayerInfo &donor, const RenX::PlayerInfo &player, double amount) override;
void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override; void RenX_OnGameOver(RenX::Server &server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override;
void RenX_OnGame(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnGame(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnExecute(RenX::Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command) override; void RenX_OnExecute(RenX::Server &server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command) override;
void RenX_OnSubscribe(RenX::Server *server, const Jupiter::ReadableString &user) override; void RenX_OnSubscribe(RenX::Server &server, const Jupiter::ReadableString &user) override;
void RenX_OnRCON(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnRCON(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnAdminLogin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminLogin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAdminGrant(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminGrant(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAdminLogout(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminLogout(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAdmin(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnAdmin(RenX::Server &server, const Jupiter::ReadableString &raw) 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_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_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_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_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_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_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_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_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_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_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_OnVoteCancel(RenX::Server &server, const RenX::TeamType &team, const Jupiter::ReadableString &type) override;
void RenX_OnVote(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnVote(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnMapChange(RenX::Server *server, const Jupiter::ReadableString &map, bool seamless) override; void RenX_OnMapChange(RenX::Server &server, const Jupiter::ReadableString &map, bool seamless) override;
void RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) override; void RenX_OnMapLoad(RenX::Server &server, const Jupiter::ReadableString &map) override;
void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &map) override; void RenX_OnMapStart(RenX::Server &server, const Jupiter::ReadableString &map) override;
void RenX_OnMap(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnMap(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnDemoRecord(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnDemoRecord(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnDemoRecord(RenX::Server *server, const Jupiter::ReadableString &user) override; void RenX_OnDemoRecord(RenX::Server &server, const Jupiter::ReadableString &user) override;
void RenX_OnDemoRecordStop(RenX::Server *server) override; void RenX_OnDemoRecordStop(RenX::Server &server) override;
void RenX_OnDemo(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnDemo(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnLog(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnLog(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnCommand(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnCommand(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnError(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnError(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnVersion(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnVersion(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnAuthorized(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnAuthorized(RenX::Server &server, const Jupiter::ReadableString &raw) override;
void RenX_OnOther(RenX::Server *server, const char token, const Jupiter::ReadableString &raw) override; void RenX_OnOther(RenX::Server &server, const char token, const Jupiter::ReadableString &raw) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
int OnRehash() override; int OnRehash() override;

172
RenX.Medals/RenX_Medals.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -19,7 +19,6 @@
#include <ctime> #include <ctime>
#include "Jupiter/Timer.h" #include "Jupiter/Timer.h"
#include "Jupiter/IRC_Client.h" #include "Jupiter/IRC_Client.h"
#include "Jupiter/DLList.h"
#include "RenX_Medals.h" #include "RenX_Medals.h"
#include "RenX_Server.h" #include "RenX_Server.h"
#include "RenX_PlayerInfo.h" #include "RenX_PlayerInfo.h"
@ -42,25 +41,25 @@ bool RenX_MedalsPlugin::initialize()
RenX_MedalsPlugin::~RenX_MedalsPlugin() RenX_MedalsPlugin::~RenX_MedalsPlugin()
{ {
RenX::Core *core = RenX::getCore(); RenX::Core *core = RenX::getCore();
unsigned int sCount = core->getServerCount(); size_t sCount = core->getServerCount();
RenX::Server *server; RenX::Server *server;
RenX::PlayerInfo *player;
for (unsigned int i = 0; i < sCount; i++) for (size_t i = 0; i < sCount; i++)
{ {
server = core->getServer(i); server = core->getServer(i);
if (server->players.size() != 0) if (server->players.size() != 0)
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); n != nullptr; n = n->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = n->data; if (node->uuid.isNotEmpty() && node->isBot == false)
if (player->uuid.isNotEmpty() && player->isBot == false)
{ {
RenX_MedalsPlugin::medalsFile[player->uuid].set("Recs"_jrs, player->varData[this->getName()].get("Recs"_jrs)); RenX_MedalsPlugin::medalsFile[node->uuid].set("Recs"_jrs, node->varData[this->getName()].get("Recs"_jrs));
RenX_MedalsPlugin::medalsFile[player->uuid].set("Noobs"_jrs, player->varData[this->getName()].get("Noobs"_jrs)); RenX_MedalsPlugin::medalsFile[node->uuid].set("Noobs"_jrs, node->varData[this->getName()].get("Noobs"_jrs));
} }
} }
} }
} }
RenX_MedalsPlugin::medalsFile.write(RenX_MedalsPlugin::medalsFileName); RenX_MedalsPlugin::medalsFile.write(RenX_MedalsPlugin::medalsFileName);
} }
@ -118,27 +117,27 @@ void RenX_MedalsPlugin::RenX_ProcessTags(Jupiter::StringType &msg, const RenX::S
} }
} }
void RenX_MedalsPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MedalsPlugin::RenX_OnPlayerCreate(RenX::Server &, const RenX::PlayerInfo &player)
{ {
if (player->uuid.isNotEmpty() && player->isBot == false) if (player.uuid.isNotEmpty() && player.isBot == false)
{ {
player->varData[this->getName()].set("Recs"_jrs, RenX_MedalsPlugin::medalsFile.get(player->uuid, "Recs"_jrs)); player.varData[this->getName()].set("Recs"_jrs, RenX_MedalsPlugin::medalsFile.get(player.uuid, "Recs"_jrs));
player->varData[this->getName()].set("Noobs"_jrs, RenX_MedalsPlugin::medalsFile.get(player->uuid, "Noobs"_jrs)); player.varData[this->getName()].set("Noobs"_jrs, RenX_MedalsPlugin::medalsFile.get(player.uuid, "Noobs"_jrs));
} }
} }
void RenX_MedalsPlugin::RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MedalsPlugin::RenX_OnPlayerDelete(RenX::Server &, const RenX::PlayerInfo &player)
{ {
if (player->uuid.isNotEmpty() && player->isBot == false) if (player.uuid.isNotEmpty() && player.isBot == false)
{ {
RenX_MedalsPlugin::medalsFile[player->uuid].set("Recs"_jrs, player->varData[this->getName()].get("Recs"_jrs)); RenX_MedalsPlugin::medalsFile[player.uuid].set("Recs"_jrs, player.varData[this->getName()].get("Recs"_jrs));
RenX_MedalsPlugin::medalsFile[player->uuid].set("Noobs"_jrs, player->varData[this->getName()].get("Noobs"_jrs)); RenX_MedalsPlugin::medalsFile[player.uuid].set("Noobs"_jrs, player.varData[this->getName()].get("Noobs"_jrs));
} }
} }
void RenX_MedalsPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MedalsPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (player->uuid.isNotEmpty() && player->isBot == false && server->isMatchInProgress()) if (player.uuid.isNotEmpty() && player.isBot == false && server.isMatchInProgress())
{ {
int worth = getWorth(player); int worth = getWorth(player);
Jupiter::Config *section = RenX_MedalsPlugin::config.getSection(RenX_MedalsPlugin::firstSection); Jupiter::Config *section = RenX_MedalsPlugin::config.getSection(RenX_MedalsPlugin::firstSection);
@ -157,41 +156,36 @@ void RenX_MedalsPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo
if (msg.isNotEmpty()) if (msg.isNotEmpty())
{ {
RenX::sanitizeTags(msg); RenX::sanitizeTags(msg);
RenX::processTags(msg, server, player); RenX::processTags(msg, &server, &player);
server->sendMessage(msg); server.sendMessage(msg);
} }
} }
} }
} }
} }
void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server &server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore)
{ {
if (server->isReliable() && server->players.size() != server->getBotCount()) if (server.isReliable() && server.players.size() != server.getBotCount())
{ {
Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); RenX::PlayerInfo *bestScore = &server.players.front();
RenX::PlayerInfo *pInfo = n->data; RenX::PlayerInfo *mostKills = &server.players.front();
RenX::PlayerInfo *bestScore = pInfo; RenX::PlayerInfo *mostVehicleKills = &server.players.front();
RenX::PlayerInfo *mostKills = pInfo; RenX::PlayerInfo *bestKD = &server.players.front();
RenX::PlayerInfo *mostVehicleKills = pInfo;
RenX::PlayerInfo *bestKD = pInfo;
while (n != nullptr)
{
pInfo = n->data;
if (pInfo->score > bestScore->score)
bestScore = pInfo;
if (pInfo->kills > mostKills->kills) for (auto node = server.players.begin(); node != server.players.end(); ++node)
mostKills = pInfo; {
if (node->score > bestScore->score)
bestScore = &*node;
if (pInfo->vehicleKills > mostVehicleKills->vehicleKills) if (node->kills > mostKills->kills)
mostVehicleKills = pInfo; mostKills = &*node;
if (RenX::getKillDeathRatio(pInfo) > RenX::getKillDeathRatio(bestKD)) if (node->vehicleKills > mostVehicleKills->vehicleKills)
bestKD = pInfo; mostVehicleKills = &*node;
n = n->next; if (RenX::getKillDeathRatio(*node) > RenX::getKillDeathRatio(*bestKD))
bestKD = &*node;
} }
CongratPlayerData *congratPlayerData; CongratPlayerData *congratPlayerData;
@ -199,10 +193,10 @@ void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winT
/** +1 for best score */ /** +1 for best score */
if (bestScore->uuid.isNotEmpty() && bestScore->isBot == false && bestScore->score > 0) if (bestScore->uuid.isNotEmpty() && bestScore->isBot == false && bestScore->score > 0)
{ {
addRec(bestScore); addRec(*bestScore);
congratPlayerData = new CongratPlayerData(); congratPlayerData = new CongratPlayerData();
congratPlayerData->server = server; congratPlayerData->server = &server;
congratPlayerData->playerName = bestScore->name; congratPlayerData->playerName = bestScore->name;
congratPlayerData->type = 0; congratPlayerData->type = 0;
new Jupiter::Timer(1, killCongratDelay, congratPlayer, congratPlayerData, false); new Jupiter::Timer(1, killCongratDelay, congratPlayer, congratPlayerData, false);
@ -211,10 +205,10 @@ void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winT
/** +1 for most kills */ /** +1 for most kills */
if (mostKills->uuid.isNotEmpty() && mostKills->isBot == false && mostKills->kills > 0) if (mostKills->uuid.isNotEmpty() && mostKills->isBot == false && mostKills->kills > 0)
{ {
addRec(mostKills); addRec(*mostKills);
congratPlayerData = new CongratPlayerData(); congratPlayerData = new CongratPlayerData();
congratPlayerData->server = server; congratPlayerData->server = &server;
congratPlayerData->playerName = mostKills->name; congratPlayerData->playerName = mostKills->name;
congratPlayerData->type = 1; congratPlayerData->type = 1;
new Jupiter::Timer(1, killCongratDelay, congratPlayer, congratPlayerData, false); new Jupiter::Timer(1, killCongratDelay, congratPlayer, congratPlayerData, false);
@ -223,22 +217,22 @@ void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winT
/** +1 for most Vehicle kills */ /** +1 for most Vehicle kills */
if (mostVehicleKills->uuid.isNotEmpty() && mostVehicleKills->isBot == false && mostVehicleKills->vehicleKills > 0) if (mostVehicleKills->uuid.isNotEmpty() && mostVehicleKills->isBot == false && mostVehicleKills->vehicleKills > 0)
{ {
addRec(mostVehicleKills); addRec(*mostVehicleKills);
congratPlayerData = new CongratPlayerData(); congratPlayerData = new CongratPlayerData();
congratPlayerData->server = server; congratPlayerData->server = &server;
congratPlayerData->playerName = mostVehicleKills->name; congratPlayerData->playerName = mostVehicleKills->name;
congratPlayerData->type = 2; congratPlayerData->type = 2;
new Jupiter::Timer(1, vehicleKillCongratDelay, congratPlayer, congratPlayerData, false); new Jupiter::Timer(1, vehicleKillCongratDelay, congratPlayer, congratPlayerData, false);
} }
/** +1 for best K/D ratio */ /** +1 for best K/D ratio */
if (bestKD->uuid.isNotEmpty() && bestKD->isBot == false && RenX::getKillDeathRatio(bestKD) > 1.0) if (bestKD->uuid.isNotEmpty() && bestKD->isBot == false && RenX::getKillDeathRatio(*bestKD) > 1.0)
{ {
addRec(bestKD); addRec(*bestKD);
congratPlayerData = new CongratPlayerData(); congratPlayerData = new CongratPlayerData();
congratPlayerData->server = server; congratPlayerData->server = &server;
congratPlayerData->playerName = bestKD->name; congratPlayerData->playerName = bestKD->name;
congratPlayerData->type = 3; congratPlayerData->type = 3;
new Jupiter::Timer(1, kdrCongratDelay, congratPlayer, congratPlayerData, false); new Jupiter::Timer(1, kdrCongratDelay, congratPlayer, congratPlayerData, false);
@ -248,14 +242,14 @@ void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winT
RenX_MedalsPlugin::medalsFile.write(medalsFileName); RenX_MedalsPlugin::medalsFile.write(medalsFileName);
} }
void RenX_MedalsPlugin::RenX_OnDestroy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) void RenX_MedalsPlugin::RenX_OnDestroy(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type)
{ {
if (type == RenX::ObjectType::Building) if (type == RenX::ObjectType::Building)
{ {
addRec(player); addRec(player);
const Jupiter::ReadableString &translated = RenX::translateName(objectName); const Jupiter::ReadableString &translated = RenX::translateName(objectName);
server->sendMessage(Jupiter::StringS::Format("%.*s has been recommended for destroying the %.*s!", player->name.size(), player->name.ptr(), translated.size(), translated.ptr())); server.sendMessage(Jupiter::StringS::Format("%.*s has been recommended for destroying the %.*s!", player.name.size(), player.name.ptr(), translated.size(), translated.ptr()));
} }
} }
@ -284,17 +278,15 @@ void RenX_MedalsPlugin::init()
RenX::Core *core = RenX::getCore(); RenX::Core *core = RenX::getCore();
unsigned int sCount = core->getServerCount(); unsigned int sCount = core->getServerCount();
RenX::Server *server; RenX::Server *server;
RenX::PlayerInfo *player;
for (unsigned int i = 0; i < sCount; i++) for (unsigned int i = 0; i < sCount; i++)
{ {
server = core->getServer(i); server = core->getServer(i);
if (server->players.size() != server->getBotCount()) if (server->players.size() != server->getBotCount())
{ {
for (Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); n != nullptr; n = n->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = n->data; node->varData[this->getName()].set("Recs"_jrs, RenX_MedalsPlugin::medalsFile[node->name].get("Recs"_jrs));
player->varData[this->getName()].set("Recs"_jrs, RenX_MedalsPlugin::medalsFile[player->name].get("Recs"_jrs)); node->varData[this->getName()].set("Noobs"_jrs, RenX_MedalsPlugin::medalsFile[node->name].get("Noobs"_jrs));
player->varData[this->getName()].set("Noobs"_jrs, RenX_MedalsPlugin::medalsFile[player->name].get("Noobs"_jrs));
} }
} }
} }
@ -325,25 +317,27 @@ void RecsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
{ {
Jupiter::Config *section = pluginInstance.medalsFile.getSection(parameters); Jupiter::Config *section = pluginInstance.medalsFile.getSection(parameters);
if (section == nullptr) if (section == nullptr)
source->sendMessage(player, "Error: Player not found! Syntax: recs [player]"_jrs); source->sendMessage(*player, "Error: Player not found! Syntax: recs [player]"_jrs);
else else
{ {
unsigned int recs = section->get<unsigned int>("Recs"_jrs); unsigned int recs = section->get<unsigned int>("Recs"_jrs);
unsigned int noobs = section->get<unsigned int>("Noobs"_jrs); unsigned int noobs = section->get<unsigned int>("Noobs"_jrs);
source->sendMessage(player, Jupiter::StringS::Format("[Archive] %.*s has %u and %u n00bs. Their worth: %d", section->getName().size(), section->getName().ptr(), recs, noobs, recs - noobs)); source->sendMessage(*player, Jupiter::StringS::Format("[Archive] %.*s has %u and %u n00bs. Their worth: %d", section->getName().size(), section->getName().ptr(), recs, noobs, recs - noobs));
} }
} }
else if (target->uuid.isEmpty()) else if (target->uuid.isEmpty())
source->sendMessage(player, "Error: Player is not using steam."_jrs); source->sendMessage(*player, "Error: Player is not using steam."_jrs);
else if (target->isBot) else if (target->isBot)
source->sendMessage(player, "Error: Bots do not have any recommendations."_jrs); source->sendMessage(*player, "Error: Bots do not have any recommendations."_jrs);
else if (target == player) else if (target == player)
RecsGameCommand::trigger(source, player, Jupiter::ReferenceString::empty); RecsGameCommand::trigger(source, player, Jupiter::ReferenceString::empty);
else source->sendMessage(player, Jupiter::StringS::Format("%.*s has %lu and %lu n00bs. Their worth: %d", target->name.size(), target->name.ptr(), getRecs(target), getNoobs(target), getWorth(target))); else
source->sendMessage(*player, Jupiter::StringS::Format("%.*s has %lu and %lu n00bs. Their worth: %d", target->name.size(), target->name.ptr(), getRecs(*target), getNoobs(*target), getWorth(*target)));
} }
else if (player->uuid.isEmpty()) else if (player->uuid.isEmpty())
source->sendMessage(player, "Error: You are not using steam."_jrs); source->sendMessage(*player, "Error: You are not using steam."_jrs);
else source->sendMessage(player, Jupiter::StringS::Format("%.*s, you have %lu recs and %lu n00bs. Your worth: %d", player->name.size(), player->name.ptr(), getRecs(player), getNoobs(player), getWorth(player))); else
source->sendMessage(*player, Jupiter::StringS::Format("%.*s, you have %lu recs and %lu n00bs. Your worth: %d", player->name.size(), player->name.ptr(), getRecs(*player), getNoobs(*player), getWorth(*player)));
} }
const Jupiter::ReadableString &RecsGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &RecsGameCommand::getHelp(const Jupiter::ReadableString &)
@ -370,21 +364,21 @@ void RecGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, con
if (target == nullptr) if (target == nullptr)
target = source->getPlayerByPartName(Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE)); target = source->getPlayerByPartName(Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE));
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, "Error: Player not found! Syntax: rec <player>"_jrs); source->sendMessage(*player, "Error: Player not found! Syntax: rec <player>"_jrs);
else if (target->uuid.isEmpty()) else if (target->uuid.isEmpty())
source->sendMessage(player, "Error: Player is not using steam."_jrs); source->sendMessage(*player, "Error: Player is not using steam."_jrs);
else if (target->isBot) else if (target->isBot)
source->sendMessage(player, "Error: Bots can not receive recommendations."_jrs); source->sendMessage(*player, "Error: Bots can not receive recommendations."_jrs);
else if (target == player) else if (target == player)
{ {
addNoob(player); addNoob(*player);
source->sendMessage(player, "You can't recommend yourself, you noob! (+1 noob)"_jrs); source->sendMessage(*player, "You can't recommend yourself, you noob! (+1 noob)"_jrs);
} }
else if (player->varData["RenX.Medals"_jrs].get("gr"_jrs) != nullptr && player->adminType.isEmpty()) else if (player->varData["RenX.Medals"_jrs].get("gr"_jrs) != nullptr && player->adminType.isEmpty())
source->sendMessage(player, "You can only give one recommendation per game."_jrs); source->sendMessage(*player, "You can only give one recommendation per game."_jrs);
else else
{ {
addRec(target); addRec(*target);
source->sendMessage(Jupiter::StringS::Format("%.*s has recommended %.*s!", player->name.size(), player->name.ptr(), target->name.size(), target->name.ptr())); source->sendMessage(Jupiter::StringS::Format("%.*s has recommended %.*s!", player->name.size(), player->name.ptr(), target->name.size(), target->name.ptr()));
player->varData["RenX.Medals"_jrs].set("gr"_jrs, "1"_jrs); player->varData["RenX.Medals"_jrs].set("gr"_jrs, "1"_jrs);
} }
@ -416,16 +410,16 @@ void NoobGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
if (target == nullptr) if (target == nullptr)
target = source->getPlayerByPartName(Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE)); target = source->getPlayerByPartName(Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE));
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, "Error: Player not found! Syntax: noob [player]"_jrs); source->sendMessage(*player, "Error: Player not found! Syntax: noob [player]"_jrs);
else if (target->uuid.isEmpty()) else if (target->uuid.isEmpty())
source->sendMessage(player, "Error: Player is not using steam."_jrs); source->sendMessage(*player, "Error: Player is not using steam."_jrs);
else if (target->isBot) else if (target->isBot)
source->sendMessage(player, "Error: Bots can not receive n00bs."_jrs); source->sendMessage(*player, "Error: Bots can not receive n00bs."_jrs);
else if (player->varData["RenX.Medals"_jrs].get("gn"_jrs) != nullptr && player->adminType.isEmpty()) else if (player->varData["RenX.Medals"_jrs].get("gn"_jrs) != nullptr && player->adminType.isEmpty())
source->sendMessage(player, "You can only give one noob per game."_jrs); source->sendMessage(*player, "You can only give one noob per game."_jrs);
else else
{ {
addNoob(target); addNoob(*target);
source->sendMessage(Jupiter::StringS::Format("%.*s has noob'd %.*s!", player->name.size(), player->name.ptr(), target->name.size(), target->name.ptr())); source->sendMessage(Jupiter::StringS::Format("%.*s has noob'd %.*s!", player->name.size(), player->name.ptr(), target->name.size(), target->name.ptr()));
player->varData["RenX.Medals"_jrs].set("gn"_jrs, "1"_jrs); player->varData["RenX.Medals"_jrs].set("gn"_jrs, "1"_jrs);
} }
@ -441,29 +435,29 @@ const Jupiter::ReadableString &NoobGameCommand::getHelp(const Jupiter::ReadableS
GAME_COMMAND_INIT(NoobGameCommand) GAME_COMMAND_INIT(NoobGameCommand)
void addRec(const RenX::PlayerInfo *player, int amount) void addRec(const RenX::PlayerInfo &player, int amount)
{ {
if (player->uuid.matchi("Player*") == false && player->isBot == false) if (player.uuid.matchi("Player*") == false && player.isBot == false)
player->varData[pluginInstance.getName()].set("Recs"_jrs, Jupiter::StringS::Format("%u", getRecs(player) + amount)); player.varData[pluginInstance.getName()].set("Recs"_jrs, Jupiter::StringS::Format("%u", getRecs(player) + amount));
} }
void addNoob(const RenX::PlayerInfo *player, int amount) void addNoob(const RenX::PlayerInfo &player, int amount)
{ {
if (player->uuid.matchi("Player*") == false && player->isBot == false) if (player.uuid.matchi("Player*") == false && player.isBot == false)
player->varData[pluginInstance.getName()].set("Noobs"_jrs, Jupiter::StringS::Format("%u", getNoobs(player) + amount)); player.varData[pluginInstance.getName()].set("Noobs"_jrs, Jupiter::StringS::Format("%u", getNoobs(player) + amount));
} }
unsigned long getRecs(const RenX::PlayerInfo *player) unsigned long getRecs(const RenX::PlayerInfo &player)
{ {
return player->varData[pluginInstance.getName()].get<unsigned long>("Recs"_jrs); return player.varData[pluginInstance.getName()].get<unsigned long>("Recs"_jrs);
} }
unsigned long getNoobs(const RenX::PlayerInfo *player) unsigned long getNoobs(const RenX::PlayerInfo &player)
{ {
return player->varData[pluginInstance.getName()].get<unsigned long>("Noobs"_jrs); return player.varData[pluginInstance.getName()].get<unsigned long>("Noobs"_jrs);
} }
int getWorth(const RenX::PlayerInfo *player) int getWorth(const RenX::PlayerInfo &player)
{ {
return getRecs(player) - getNoobs(player); return getRecs(player) - getNoobs(player);
} }

22
RenX.Medals/RenX_Medals.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,30 +26,30 @@
#include "RenX_GameCommand.h" #include "RenX_GameCommand.h"
/** Adds a recommendation to the player's medal data */ /** Adds a recommendation to the player's medal data */
void addRec(const RenX::PlayerInfo *player, int amount = 1); void addRec(const RenX::PlayerInfo &player, int amount = 1);
/** Adds a noob to the player's medal data */ /** Adds a noob to the player's medal data */
void addNoob(const RenX::PlayerInfo *player, int amount = 1); void addNoob(const RenX::PlayerInfo &player, int amount = 1);
/** Fetches a player's recommendation count */ /** Fetches a player's recommendation count */
unsigned long getRecs(const RenX::PlayerInfo *player); unsigned long getRecs(const RenX::PlayerInfo &player);
/** Fetches a player's noob count */ /** Fetches a player's noob count */
unsigned long getNoobs(const RenX::PlayerInfo *player); unsigned long getNoobs(const RenX::PlayerInfo &player);
/** Calculates a player's worth (recs - noobs) */ /** Calculates a player's worth (recs - noobs) */
int getWorth(const RenX::PlayerInfo *player); int getWorth(const RenX::PlayerInfo &player);
class RenX_MedalsPlugin : public RenX::Plugin class RenX_MedalsPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_SanitizeTags(Jupiter::StringType &fmt) override; void RenX_SanitizeTags(Jupiter::StringType &fmt) override;
void RenX_ProcessTags(Jupiter::StringType &msg, const RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const RenX::BuildingInfo *building) override; void RenX_ProcessTags(Jupiter::StringType &msg, const RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const RenX::BuildingInfo *building) override;
void RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerCreate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerDelete(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override; void RenX_OnGameOver(RenX::Server &server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override;
void RenX_OnDestroy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; void RenX_OnDestroy(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override;
~RenX_MedalsPlugin(); ~RenX_MedalsPlugin();
public: // Jupiter::Plugin public: // Jupiter::Plugin

50
RenX.MinPlayers/RenX_MinPlayers.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,47 +29,47 @@ bool RenX_MinPlayersPlugin::initialize()
return true; return true;
} }
void RenX_MinPlayersPlugin::RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &map) void RenX_MinPlayersPlugin::RenX_OnMapStart(RenX::Server &server, const Jupiter::ReadableString &map)
{ {
if (server->players.size() < RenX_MinPlayersPlugin::player_threshold) if (server.players.size() < RenX_MinPlayersPlugin::player_threshold)
server->send(Jupiter::StringS::Format("addbots %d", RenX_MinPlayersPlugin::player_threshold - server->players.size())); server.send(Jupiter::StringS::Format("addbots %d", RenX_MinPlayersPlugin::player_threshold - server.players.size()));
} }
void RenX_MinPlayersPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MinPlayersPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (server->players.size() > RenX_MinPlayersPlugin::player_threshold && server->isMatchInProgress()) if (server.players.size() > RenX_MinPlayersPlugin::player_threshold && server.isMatchInProgress())
++RenX_MinPlayersPlugin::phase_bots; ++RenX_MinPlayersPlugin::phase_bots;
} }
void RenX_MinPlayersPlugin::RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MinPlayersPlugin::RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (server->isMatchInProgress() && server->players.size() <= player_threshold) if (server.isMatchInProgress() && server.players.size() <= player_threshold)
{ {
switch (player->team) switch (player.team)
{ {
case RenX::TeamType::GDI: case RenX::TeamType::GDI:
server->send("addredbots 1"_jrs); server.send("addredbots 1"_jrs);
break; break;
case RenX::TeamType::Nod: case RenX::TeamType::Nod:
server->send("addbluebots 1"_jrs); server.send("addbluebots 1"_jrs);
break; break;
case RenX::TeamType::None: case RenX::TeamType::None:
break; break;
default: default:
server->send("addbots 1"_jrs); server.send("addbots 1"_jrs);
break; break;
} }
} }
} }
void RenX_MinPlayersPlugin::AnyDeath(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_MinPlayersPlugin::AnyDeath(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (RenX_MinPlayersPlugin::phase_bots != 0 && player->isBot && server->players.size() != 0) if (RenX_MinPlayersPlugin::phase_bots != 0 && player.isBot && server.players.size() != 0)
{ {
size_t gdi_count = 0, nod_count = 0; size_t gdi_count = 0, nod_count = 0;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = server->players.getNode(0); node != nullptr; node = node->next) for (auto node = server.players.begin(); node != server.players.end(); ++node)
{ {
switch (node->data->team) switch (node->team)
{ {
case RenX::TeamType::GDI: case RenX::TeamType::GDI:
++gdi_count; ++gdi_count;
@ -84,44 +84,44 @@ void RenX_MinPlayersPlugin::AnyDeath(RenX::Server *server, const RenX::PlayerInf
if (gdi_count > nod_count) if (gdi_count > nod_count)
{ {
if (player->team != RenX::TeamType::Nod) if (player.team != RenX::TeamType::Nod)
{ {
server->kickPlayer(player, "Bot Phasing"_jrs); server.kickPlayer(player, "Bot Phasing"_jrs);
--RenX_MinPlayersPlugin::phase_bots; --RenX_MinPlayersPlugin::phase_bots;
} }
} }
else if (nod_count > gdi_count) else if (nod_count > gdi_count)
{ {
if (player->team != RenX::TeamType::GDI) if (player.team != RenX::TeamType::GDI)
{ {
server->kickPlayer(player, "Bot Phasing"_jrs); server.kickPlayer(player, "Bot Phasing"_jrs);
--RenX_MinPlayersPlugin::phase_bots; --RenX_MinPlayersPlugin::phase_bots;
} }
} }
else else
{ {
server->kickPlayer(player, "Bot Phasing"_jrs); server.kickPlayer(player, "Bot Phasing"_jrs);
--RenX_MinPlayersPlugin::phase_bots; --RenX_MinPlayersPlugin::phase_bots;
} }
} }
} }
void RenX_MinPlayersPlugin::RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) void RenX_MinPlayersPlugin::RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType)
{ {
this->AnyDeath(server, player); this->AnyDeath(server, player);
} }
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType)
{ {
this->AnyDeath(server, player); this->AnyDeath(server, player);
} }
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType)
{ {
this->AnyDeath(server, victim); this->AnyDeath(server, victim);
} }
void RenX_MinPlayersPlugin::RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) void RenX_MinPlayersPlugin::RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType)
{ {
this->AnyDeath(server, player); this->AnyDeath(server, player);
} }

18
RenX.MinPlayers/RenX_MinPlayers.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,19 +26,19 @@
class RenX_MinPlayersPlugin : public RenX::Plugin class RenX_MinPlayersPlugin : public RenX::Plugin
{ {
public: public:
void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &map) override; void RenX_OnMapStart(RenX::Server &server, const Jupiter::ReadableString &map) override;
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
void RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
void RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server &server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo &victim, const Jupiter::ReadableString &damageType) override;
void RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, const Jupiter::ReadableString &damageType) override;
virtual bool initialize() override; virtual bool initialize() override;
private: private:
void AnyDeath(RenX::Server *server, const RenX::PlayerInfo *player); void AnyDeath(RenX::Server &server, const RenX::PlayerInfo &player);
size_t phase_bots; size_t phase_bots;
/** Configuration variables */ /** Configuration variables */

311
RenX.ModSystem/RenX_ModSystem.cpp

@ -54,7 +54,9 @@ bool RenX_ModSystemPlugin::initialize()
while (groupName.isNotEmpty()) while (groupName.isNotEmpty())
{ {
group = new ModGroup(); // Add group
groups.emplace_back();
group = &groups.back();
group->name = groupName; group->name = groupName;
groupName += dotLockSteam; groupName += dotLockSteam;
@ -93,8 +95,7 @@ bool RenX_ModSystemPlugin::initialize()
group->gamePrefix = this->config.get(groupName); group->gamePrefix = this->config.get(groupName);
groupName.truncate(dotGamePrefix.size()); groupName.truncate(dotGamePrefix.size());
RenX_ModSystemPlugin::groups.add(group); // Next
groupName += dotNext; groupName += dotNext;
groupName = this->config.get(groupName); groupName = this->config.get(groupName);
} }
@ -106,95 +107,95 @@ bool RenX_ModSystemPlugin::initialize()
{ {
server = core->getServer(--total); server = core->getServer(--total);
if (server->players.size() != server->getBotCount()) if (server->players.size() != server->getBotCount())
for (Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); n != nullptr; n = n->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
RenX_ModSystemPlugin::auth(server, n->data, true); RenX_ModSystemPlugin::auth(*server, *node, true);
} }
return true; return true;
} }
unsigned int RenX_ModSystemPlugin::logoutAllMods(const RenX::Server *server) unsigned int RenX_ModSystemPlugin::logoutAllMods(RenX::Server &server)
{ {
if (server->players.size() == 0) if (server.players.size() == 0)
return 0; return 0;
unsigned int total = 0; unsigned int total = 0;
for (Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); n != nullptr; n = n->next) for (auto node = server.players.begin(); node != server.players.end(); ++node)
if (RenX_ModSystemPlugin::resetAccess(n->data)) if (RenX_ModSystemPlugin::resetAccess(*node))
total++; total++;
return total; return total;
} }
bool RenX_ModSystemPlugin::resetAccess(RenX::PlayerInfo *player) bool RenX_ModSystemPlugin::resetAccess(RenX::PlayerInfo &player)
{ {
int oAccess = player->access; int oAccess = player.access;
if (player->adminType.equals("administrator")) if (player.adminType.equals("administrator"))
{ {
ModGroup *group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup); ModGroup *group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup);
if (group == nullptr) if (group == nullptr)
player->access = 2; player.access = 2;
else else
player->access = group->access; player.access = group->access;
} }
else if (player->adminType.equals("moderator")) else if (player.adminType.equals("moderator"))
{ {
ModGroup *group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup); ModGroup *group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup);
if (group == nullptr) if (group == nullptr)
player->access = 1; player.access = 1;
else else
player->access = group->access; player.access = group->access;
} }
else if (groups.size() != 0) else if (groups.size() != 0)
player->access = groups.get(0)->access; player.access = groups.front().access;
else else
player->access = 0; player.access = 0;
return player->access != oAccess; return player.access != oAccess;
} }
int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *player, bool checkAuto, bool forceAuth) const int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &player, bool checkAuto, bool forceAuth) const
{ {
if (player->isBot) if (player.isBot)
return 0; return 0;
ModGroup *group; const ModGroup *group;
if (player->uuid.isNotEmpty()) if (player.uuid.isNotEmpty())
{ {
Jupiter::Config *section = this->config.getSection(player->uuid); Jupiter::Config *section = this->config.getSection(player.uuid);
if (section != nullptr) if (section != nullptr)
{ {
const Jupiter::ReadableString &groupName = section->get("Group"_jrs); const Jupiter::ReadableString &groupName = section->get("Group"_jrs);
if (groupName.isEmpty()) if (groupName.isEmpty())
group = RenX_ModSystemPlugin::groups.get(0); group = &RenX_ModSystemPlugin::groups.front();
else else
{ {
group = RenX_ModSystemPlugin::getGroupByName(groupName); group = RenX_ModSystemPlugin::getGroupByName(groupName);
if (group == nullptr) if (group == nullptr)
group = RenX_ModSystemPlugin::groups.get(0); group = &RenX_ModSystemPlugin::groups.front();
} }
auto sectionAuth = [&] auto sectionAuth = [&]
{ {
player->varData[this->name].set("Group"_jrs, group->name); player.varData[this->name].set("Group"_jrs, group->name);
player->formatNamePrefix = section->get("Prefix"_jrs, group->prefix); player.formatNamePrefix = section->get("Prefix"_jrs, group->prefix);
player->gamePrefix = section->get("GamePrefix"_jrs, group->gamePrefix); player.gamePrefix = section->get("GamePrefix"_jrs, group->gamePrefix);
player->access = section->get<int>("Access"_jrs, group->access); player.access = section->get<int>("Access"_jrs, group->access);
if (player->access != 0) if (player.access != 0)
{ {
server->sendMessage(player, Jupiter::StringS::Format("You are now authenticated with access level %d; group: %.*s.", player->access, group->name.size(), group->name.ptr())); server.sendMessage(player, Jupiter::StringS::Format("You are now authenticated with access level %d; group: %.*s.", player.access, group->name.size(), group->name.ptr()));
if (server->isDevBot() && player->access > 1) if (server.isDevBot() && player.access > 1)
{ {
if (server->getVersion() >= 4) if (server.getVersion() >= 4)
server->sendData(Jupiter::StringS::Format("dset_dev %d\n", player->id)); server.sendData(Jupiter::StringS::Format("dset_dev %d\n", player.id));
else else
server->sendData(Jupiter::StringS::Format("d%d\n", player->id)); server.sendData(Jupiter::StringS::Format("d%d\n", player.id));
} }
} }
Jupiter::String playerName = RenX::getFormattedPlayerName(player); Jupiter::String playerName = RenX::getFormattedPlayerName(player);
server->sendLogChan(IRCCOLOR "03[Authentication] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " is now authenticated with access level %d; group: %.*s.", playerName.size(), playerName.ptr(), player->access, group->name.size(), group->name.ptr()); server.sendLogChan(IRCCOLOR "03[Authentication] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " is now authenticated with access level %d; group: %.*s.", playerName.size(), playerName.ptr(), player.access, group->name.size(), group->name.ptr());
return player->access; return player.access;
}; };
if (forceAuth) if (forceAuth)
@ -211,46 +212,46 @@ int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *pla
const Jupiter::ReadableString &ip = section->get("LastIP"_jrs); const Jupiter::ReadableString &ip = section->get("LastIP"_jrs);
const Jupiter::ReadableString &name = section->get("Name"_jrs); const Jupiter::ReadableString &name = section->get("Name"_jrs);
if ((lockSteam_l == false || player->steamid == steamid) && (lockIP_l == false || player->ip.equalsi(ip)) && (lockName_l == false || player->name.equalsi(name))) if ((lockSteam_l == false || player.steamid == steamid) && (lockIP_l == false || player.ip.equalsi(ip)) && (lockName_l == false || player.name.equalsi(name)))
{ {
if (checkAuto == false || (autoAuthSteam_l && player->steamid == steamid) || (autoAuthIP_l && player->ip.equalsi(ip))) if (checkAuto == false || (autoAuthSteam_l && player.steamid == steamid) || (autoAuthIP_l && player.ip.equalsi(ip)))
return sectionAuth(); return sectionAuth();
} }
else if (kickLockMismatch_l) else if (kickLockMismatch_l)
{ {
server->kickPlayer(player, "Moderator entry lock mismatch"_jrs); server.kickPlayer(player, "Moderator entry lock mismatch"_jrs);
return -1; return -1;
} }
} }
} }
group = this->getDefaultGroup(); group = this->getDefaultGroup();
player->varData[this->name].set("Group"_jrs, group->name); player.varData[this->name].set("Group"_jrs, group->name);
player->formatNamePrefix = group->prefix; player.formatNamePrefix = group->prefix;
player->gamePrefix = group->gamePrefix; player.gamePrefix = group->gamePrefix;
return player->access = group->access; return player.access = group->access;
} }
void RenX_ModSystemPlugin::tempAuth(RenX::Server *server, const RenX::PlayerInfo *player, const ModGroup *group, bool notify) const void RenX_ModSystemPlugin::tempAuth(RenX::Server &server, const RenX::PlayerInfo &player, const ModGroup *group, bool notify) const
{ {
if (group == nullptr) if (group == nullptr)
group = this->getDefaultGroup(); group = this->getDefaultGroup();
player->varData[name].set("Group"_jrs, group->name); player.varData[name].set("Group"_jrs, group->name);
player->formatNamePrefix = group->prefix; player.formatNamePrefix = group->prefix;
player->gamePrefix = group->gamePrefix; player.gamePrefix = group->gamePrefix;
player->access = group->access; player.access = group->access;
if (notify) if (notify)
server->sendMessage(player, Jupiter::StringS::Format("You have been authorized into group \"%.*s\", with access level %u.", group->name.size(), group->name.ptr(), player->access)); server.sendMessage(player, Jupiter::StringS::Format("You have been authorized into group \"%.*s\", with access level %u.", group->name.size(), group->name.ptr(), player.access));
} }
bool RenX_ModSystemPlugin::set(RenX::PlayerInfo *player, RenX_ModSystemPlugin::ModGroup *group) bool RenX_ModSystemPlugin::set(RenX::PlayerInfo &player, RenX_ModSystemPlugin::ModGroup &group)
{ {
bool r = this->config[player->uuid].set("Group"_jrs, group->name); bool r = this->config[player.uuid].set("Group"_jrs, group.name);
this->config[player->uuid].set("SteamID"_jrs, Jupiter::StringS::Format("%llu", player->steamid)); this->config[player.uuid].set("SteamID"_jrs, Jupiter::StringS::Format("%llu", player.steamid));
this->config[player->uuid].set("LastIP"_jrs, player->ip); this->config[player.uuid].set("LastIP"_jrs, player.ip);
this->config[player->uuid].set("Name"_jrs, player->name); this->config[player.uuid].set("Name"_jrs, player.name);
this->config.write(); this->config.write();
return r; return r;
@ -259,9 +260,9 @@ bool RenX_ModSystemPlugin::set(RenX::PlayerInfo *player, RenX_ModSystemPlugin::M
RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByName(const Jupiter::ReadableString &name, ModGroup *defaultGroup) const RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByName(const Jupiter::ReadableString &name, ModGroup *defaultGroup) const
{ {
if (RenX_ModSystemPlugin::groups.size() != 0) if (RenX_ModSystemPlugin::groups.size() != 0)
for (Jupiter::DLList<ModGroup>::Node *n = groups.getNode(0); n != nullptr; n = n->next) for (auto node = this->groups.begin(); node != this->groups.end(); ++node)
if (n->data->name.equalsi(name)) if (node->name.equalsi(name))
return n->data; return const_cast<ModGroup *>(&*node);
return defaultGroup; return defaultGroup;
} }
@ -269,9 +270,9 @@ RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByName(const Jupit
RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByAccess(int access, ModGroup *defaultGroup) const RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByAccess(int access, ModGroup *defaultGroup) const
{ {
if (RenX_ModSystemPlugin::groups.size() != 0) if (RenX_ModSystemPlugin::groups.size() != 0)
for (Jupiter::DLList<ModGroup>::Node *n = groups.getNode(0); n != nullptr; n = n->next) for (auto node = this->groups.begin(); node != this->groups.end(); ++node)
if (n->data->access == access) if (node->access == access)
return n->data; return const_cast<ModGroup *>(&*node);
return defaultGroup; return defaultGroup;
} }
@ -279,9 +280,9 @@ RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByAccess(int acces
RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByIndex(size_t index) const RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByIndex(size_t index) const
{ {
if (RenX_ModSystemPlugin::groups.size() != 0) if (RenX_ModSystemPlugin::groups.size() != 0)
for (Jupiter::DLList<ModGroup>::Node *n = groups.getNode(0); n != nullptr; n = n->next) for (auto node = this->groups.begin(); node != this->groups.end(); ++node)
if (index-- == 0) if (index-- == 0)
return n->data; return const_cast<ModGroup *>(&*node);
return nullptr; return nullptr;
} }
@ -291,10 +292,11 @@ int RenX_ModSystemPlugin::getConfigAccess(const Jupiter::ReadableString &uuid) c
Jupiter::Config *section = this->config.getSection(uuid); Jupiter::Config *section = this->config.getSection(uuid);
if (section == nullptr) if (section == nullptr)
return RenX_ModSystemPlugin::groups.get(0)->access; return RenX_ModSystemPlugin::groups.front().access;
//for (auto node = this->groups.begin(); node != this->groups.end(); ++node)
RenX_ModSystemPlugin::ModGroup *group = RenX_ModSystemPlugin::getGroupByName(section->get("Group"_jrs), groups.get(0)); return section->get<int>("Access"_jrs,
return section->get<int>("Access"_jrs, group->access); RenX_ModSystemPlugin::getGroupByName(section->get("Group"_jrs),
const_cast<ModGroup *>(&groups.front()))->access);
} }
size_t RenX_ModSystemPlugin::getGroupCount() const size_t RenX_ModSystemPlugin::getGroupCount() const
@ -304,7 +306,7 @@ size_t RenX_ModSystemPlugin::getGroupCount() const
RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getDefaultGroup() const RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getDefaultGroup() const
{ {
return RenX_ModSystemPlugin::groups.get(0); return const_cast<ModGroup *>(&RenX_ModSystemPlugin::groups.front());
} }
RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getDefaultATMGroup() const RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getDefaultATMGroup() const
@ -327,85 +329,83 @@ RenX_ModSystemPlugin::~RenX_ModSystemPlugin()
RenX::Core *core = RenX::getCore(); RenX::Core *core = RenX::getCore();
unsigned int total = core->getServerCount(); unsigned int total = core->getServerCount();
RenX::Server *server; RenX::Server *server;
RenX::PlayerInfo *player;
while (total != 0) while (total != 0)
{ {
server = core->getServer(--total); server = core->getServer(--total);
if (server->players.size() != server->getBotCount()) if (server->players.size() != server->getBotCount())
for (Jupiter::DLList<RenX::PlayerInfo>::Node *n = server->players.getNode(0); n != nullptr; n = n->next) for (auto node = server->players.begin(); node != server->players.end(); ++node)
{ {
player = n->data; if (node->isBot == false)
if (player->isBot == false)
{ {
player->varData[RenX_ModSystemPlugin::name].remove("Group"_jrs); node->varData[RenX_ModSystemPlugin::name].remove("Group"_jrs);
player->gamePrefix.truncate(player->gamePrefix.size()); node->gamePrefix.truncate(node->gamePrefix.size());
player->formatNamePrefix.truncate(player->formatNamePrefix.size()); node->formatNamePrefix.truncate(node->formatNamePrefix.size());
if (player->adminType.equals("administrator")) if (node->adminType.equals("administrator"))
player->access = 2; node->access = 2;
else if (player->adminType.equals("moderator")) else if (node->adminType.equals("moderator"))
player->access = 1; node->access = 1;
else else
player->access = 0; node->access = 0;
} }
} }
} }
while (RenX_ModSystemPlugin::groups.size() != 0)
delete RenX_ModSystemPlugin::groups.remove(size_t{ 0 }); RenX_ModSystemPlugin::groups.clear();
} }
void RenX_ModSystemPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnPlayerCreate(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (player->isBot == false) if (player.isBot == false)
RenX_ModSystemPlugin::auth(server, player, true); RenX_ModSystemPlugin::auth(server, player, true);
} }
void RenX_ModSystemPlugin::RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnPlayerDelete(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (RenX_ModSystemPlugin::groups.size() != 0 && player->isBot == false && player->uuid.isNotEmpty()) if (RenX_ModSystemPlugin::groups.size() != 0 && player.isBot == false && player.uuid.isNotEmpty())
{ {
Jupiter::Config *section = this->config.getSection(player->uuid); Jupiter::Config *section = this->config.getSection(player.uuid);
if (section != nullptr) if (section != nullptr)
{ {
section->set("SteamID"_jrs, Jupiter::StringS::Format("%llu", player->steamid)); section->set("SteamID"_jrs, Jupiter::StringS::Format("%llu", player.steamid));
section->set("LastIP"_jrs, player->ip); section->set("LastIP"_jrs, player.ip);
section->set("Name"_jrs, player->name); section->set("Name"_jrs, player.name);
} }
} }
} }
void RenX_ModSystemPlugin::RenX_OnIDChange(RenX::Server *server, const RenX::PlayerInfo *player, int oldID) void RenX_ModSystemPlugin::RenX_OnIDChange(RenX::Server &server, const RenX::PlayerInfo &player, int oldID)
{ {
if (player->access != 0 && server->isDevBot()) if (player.access != 0 && server.isDevBot())
server->sendData(Jupiter::StringS::Format("d%d\n", player->id)); server.sendData(Jupiter::StringS::Format("d%d\n", player.id));
} }
void RenX_ModSystemPlugin::RenX_OnAdminLogin(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnAdminLogin(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
ModGroup *group = nullptr; ModGroup *group = nullptr;
if (player->adminType.equals("administrator")) if (player.adminType.equals("administrator"))
group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup); group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup);
else if (player->adminType.equals("moderator")) else if (player.adminType.equals("moderator"))
group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup); group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup);
if (group != nullptr && player->access < group->access) if (group != nullptr && player.access < group->access)
player->access = group->access; player.access = group->access;
} }
void RenX_ModSystemPlugin::RenX_OnAdminGrant(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnAdminGrant(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
RenX_ModSystemPlugin::RenX_OnAdminLogin(server, player); RenX_ModSystemPlugin::RenX_OnAdminLogin(server, player);
} }
void RenX_ModSystemPlugin::RenX_OnAdminLogout(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnAdminLogout(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
ModGroup *group = nullptr; ModGroup *group = nullptr;
int access = RenX_ModSystemPlugin::groups.size() == 0 ? 0 : RenX_ModSystemPlugin::groups.get(0)->access; int access = RenX_ModSystemPlugin::groups.size() == 0 ? 0 : RenX_ModSystemPlugin::groups.front().access;
if (player->adminType.equals("administrator")) if (player.adminType.equals("administrator"))
{ {
access = 2; access = 2;
group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup); group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::administratorGroup);
} }
else if (player->adminType.equals("moderator")) else if (player.adminType.equals("moderator"))
{ {
access = 1; access = 1;
group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup); group = RenX_ModSystemPlugin::getGroupByName(RenX_ModSystemPlugin::moderatorGroup);
@ -413,22 +413,19 @@ void RenX_ModSystemPlugin::RenX_OnAdminLogout(RenX::Server *server, const RenX::
if (group != nullptr) if (group != nullptr)
access = group->access; access = group->access;
if (player->access <= access) if (player.access <= access)
{ {
if (RenX_ModSystemPlugin::groups.size() == 0) if (RenX_ModSystemPlugin::groups.size() == 0)
player->access = 0; player.access = 0;
else else
player->access = RenX_ModSystemPlugin::groups.get(0)->access; player.access = RenX_ModSystemPlugin::groups.front().access;
} }
} }
int RenX_ModSystemPlugin::OnRehash() int RenX_ModSystemPlugin::OnRehash()
{ {
RenX::Plugin::OnRehash(); RenX::Plugin::OnRehash();
RenX_ModSystemPlugin::groups.clear();
while (RenX_ModSystemPlugin::groups.size() != 0)
delete RenX_ModSystemPlugin::groups.remove(size_t{ 0 });
return this->initialize() ? 0 : -1; return this->initialize() ? 0 : -1;
} }
@ -478,7 +475,7 @@ void AuthIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
else else
{ {
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup(); RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
if (pluginInstance.auth(server, player) == -1) if (pluginInstance.auth(*server, *player) == -1)
source->sendNotice(nick, "Error: Player failed to pass strict lock checks. Player kicked."_jrs); source->sendNotice(nick, "Error: Player failed to pass strict lock checks. Player kicked."_jrs);
else if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs))) else if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs)))
source->sendNotice(nick, "Error: Failed to authenticate player."_jrs); source->sendNotice(nick, "Error: Failed to authenticate player."_jrs);
@ -541,7 +538,7 @@ void DeAuthIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
int cAccess = pluginInstance.getConfigAccess(player->uuid); int cAccess = pluginInstance.getConfigAccess(player->uuid);
if (cAccess > uAccess && uAccess < static_cast<int>(source->getPrefixes().size())) if (cAccess > uAccess && uAccess < static_cast<int>(source->getPrefixes().size()))
source->sendNotice(nick, "Error: Can't unauthenticate higher level moderators."_jrs); source->sendNotice(nick, "Error: Can't unauthenticate higher level moderators."_jrs);
else if (pluginInstance.resetAccess(player)) else if (pluginInstance.resetAccess(*player))
source->sendNotice(nick, "Player unauthenticated successfully."_jrs); source->sendNotice(nick, "Player unauthenticated successfully."_jrs);
else else
source->sendNotice(nick, "Error: Player not authenticated."_jrs); source->sendNotice(nick, "Error: Player not authenticated."_jrs);
@ -600,7 +597,7 @@ void ATMIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &chan
} }
else else
{ {
group = pluginInstance.groups.get(index); group = pluginInstance.getGroupByIndex(index);
if (group->access > source->getAccessLevel(channel, nick)) if (group->access > source->getAccessLevel(channel, nick))
{ {
group = pluginInstance.getDefaultATMGroup(); group = pluginInstance.getDefaultATMGroup();
@ -628,7 +625,7 @@ void ATMIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &chan
source->sendNotice(nick, "Error: This command can not lower a player's access level."_jrs); source->sendNotice(nick, "Error: This command can not lower a player's access level."_jrs);
else else
{ {
pluginInstance.tempAuth(server, player, group); pluginInstance.tempAuth(*server, *player, group);
source->sendNotice(nick, "Player successfully temporarily authenticated."_jrs); source->sendNotice(nick, "Player successfully temporarily authenticated."_jrs);
} }
} }
@ -681,7 +678,7 @@ void AddIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &chan
source->sendNotice(nick, "Error: Invalid group index."_jrs); source->sendNotice(nick, "Error: Invalid group index."_jrs);
else else
{ {
group = pluginInstance.groups.get(index); group = pluginInstance.getGroupByIndex(index);
playerName = playerName.gotoWord(1, WHITESPACE); playerName = playerName.gotoWord(1, WHITESPACE);
} }
} }
@ -704,12 +701,12 @@ void AddIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &chan
source->sendNotice(nick, "Error: Player has no UUID."_jrs); source->sendNotice(nick, "Error: Player has no UUID."_jrs);
else else
{ {
pluginInstance.resetAccess(player); pluginInstance.resetAccess(*player);
if (pluginInstance.set(player, group)) if (pluginInstance.set(*player, *group))
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been added to group \"%.*s\"", player->name.size(), player->name.ptr(), group->name.size(), group->name.ptr())); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been added to group \"%.*s\"", player->name.size(), player->name.ptr(), group->name.size(), group->name.ptr()));
else else
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been moved to group \"%.*s\"", player->name.size(), player->name.ptr(), group->name.size(), group->name.ptr())); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been moved to group \"%.*s\"", player->name.size(), player->name.ptr(), group->name.size(), group->name.ptr()));
pluginInstance.auth(server, player, false, true); pluginInstance.auth(*server, *player, false, true);
} }
} }
} }
@ -854,7 +851,7 @@ void ForceAuthIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
else else
{ {
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup(); RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
pluginInstance.auth(server, player, false, true); pluginInstance.auth(*server, *player, false, true);
if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs))) if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs)))
source->sendNotice(nick, "Error: Failed to authenticate player."_jrs); source->sendNotice(nick, "Error: Failed to authenticate player."_jrs);
else else
@ -889,21 +886,19 @@ void ModListIRCCommand::create()
void ModListIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &parameters) void ModListIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &parameters)
{ {
RenX_ModSystemPlugin::ModGroup *group;
Jupiter::String msg; Jupiter::String msg;
size_t msgBaseSize; size_t msgBaseSize;
bool haveMods = false; bool haveMods = false;
for (Jupiter::DLList<RenX_ModSystemPlugin::ModGroup>::Node *n = pluginInstance.groups.getHead(); n != nullptr; n = n->next) for (auto node = pluginInstance.groups.begin(); node != pluginInstance.groups.end(); ++node)
{ {
group = n->data; msg = node->prefix;
msg = group->prefix; msg += node->name;
msg += group->name; msg.aformat(IRCNORMAL " (Access: %d): ", node->access);
msg.aformat(IRCNORMAL " (Access: %d): ", group->access);
msgBaseSize = msg.size(); msgBaseSize = msg.size();
auto entry_callback = [&msg, group](Jupiter::Config::SectionHashTable::Bucket::Entry &in_entry) auto entry_callback = [&msg, &node](Jupiter::Config::SectionHashTable::Bucket::Entry &in_entry)
{ {
if (in_entry.value.get("Group"_jrs).equalsi(group->name)) if (in_entry.value.get("Group"_jrs).equalsi(node->name))
{ {
msg += in_entry.value.get("Name"_jrs, in_entry.value.getName()); msg += in_entry.value.get("Name"_jrs, in_entry.value.getName());
msg += ", "_jrs; msg += ", "_jrs;
@ -947,32 +942,32 @@ void AuthGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, "Error: Player not found."_jrs); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target == player) else if (target == player)
source->sendMessage(player, "Error: You can not authenticate yourself."_jrs); source->sendMessage(*player, "Error: You can not authenticate yourself."_jrs);
else else
{ {
int cAccess = pluginInstance.getConfigAccess(target->uuid); int cAccess = pluginInstance.getConfigAccess(target->uuid);
if (cAccess > player->access) if (cAccess > player->access)
source->sendMessage(player, "Error: Can't authenticate higher level moderators."_jrs); source->sendMessage(*player, "Error: Can't authenticate higher level moderators."_jrs);
else if (target->access == cAccess) else if (target->access == cAccess)
source->sendMessage(player, "Error: Player is already authenticated"_jrs); source->sendMessage(*player, "Error: Player is already authenticated"_jrs);
else if (target->access > cAccess) else if (target->access > cAccess)
source->sendMessage(player, "Error: Player is already temporarily authenticated."_jrs); source->sendMessage(*player, "Error: Player is already temporarily authenticated."_jrs);
else else
{ {
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup(); RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
if (pluginInstance.auth(source, player) == -1) if (pluginInstance.auth(*source, *player) == -1)
source->sendMessage(player, "Error: Player failed to pass strict lock checks. Player kicked."_jrs); source->sendMessage(*player, "Error: Player failed to pass strict lock checks. Player kicked."_jrs);
else if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs))) else if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs)))
source->sendMessage(player, "Error: Failed to authenticate player."_jrs); source->sendMessage(*player, "Error: Failed to authenticate player."_jrs);
else else
source->sendMessage(player, "Player authenticated successfully."_jrs); source->sendMessage(*player, "Player authenticated successfully."_jrs);
} }
} }
} }
else else
source->sendMessage(player, "Error: Too few parameters. Syntax: auth <player>"_jrs); source->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"_jrs);
} }
const Jupiter::ReadableString &AuthGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &AuthGameCommand::getHelp(const Jupiter::ReadableString &)
@ -1003,19 +998,19 @@ void ATMGameCommand::trigger(RenX::Server *server, RenX::PlayerInfo *player, con
int index = parameters.asInt(); int index = parameters.asInt();
if (index < 0 || index >= static_cast<int>(pluginInstance.groups.size())) if (index < 0 || index >= static_cast<int>(pluginInstance.groups.size()))
server->sendMessage(player, "Warning: Invalid group index. Ingoring parameter..."_jrs); server->sendMessage(*player, "Warning: Invalid group index. Ingoring parameter..."_jrs);
else if (index == 0) else if (index == 0)
{ {
server->sendMessage(player, "Error: Default group is not valid for this command. Use \"deauth\" to deauthorize a player."_jrs); server->sendMessage(*player, "Error: Default group is not valid for this command. Use \"deauth\" to deauthorize a player."_jrs);
return; return;
} }
else else
{ {
group = pluginInstance.groups.get(index); group = pluginInstance.getGroupByIndex(index);
if (group->access > player->access) if (group->access > player->access)
{ {
group = pluginInstance.getDefaultATMGroup(); group = pluginInstance.getDefaultATMGroup();
server->sendMessage(player, "Warning: You can not authorize an access level higher than yourself. Ignoring parameter..."_jrs); server->sendMessage(*player, "Warning: You can not authorize an access level higher than yourself. Ignoring parameter..."_jrs);
} }
playerName = playerName.gotoWord(1, WHITESPACE); playerName = playerName.gotoWord(1, WHITESPACE);
} }
@ -1024,20 +1019,20 @@ void ATMGameCommand::trigger(RenX::Server *server, RenX::PlayerInfo *player, con
{ {
target = server->getPlayerByPartName(playerName); target = server->getPlayerByPartName(playerName);
if (target == nullptr) if (target == nullptr)
server->sendMessage(player, "Error: Player not found."_jrs); server->sendMessage(*player, "Error: Player not found."_jrs);
else if (target->access > group->access) else if (target->access > group->access)
server->sendMessage(player, "Error: This command can not lower a player's access level."_jrs); server->sendMessage(*player, "Error: This command can not lower a player's access level."_jrs);
else else
{ {
pluginInstance.tempAuth(server, target, group); pluginInstance.tempAuth(*server, *target, group);
server->sendMessage(player, "Player successfully temporarily authenticated."_jrs); server->sendMessage(*player, "Player successfully temporarily authenticated."_jrs);
} }
} }
else else
server->sendMessage(player, "Error: Invalid group."_jrs); server->sendMessage(*player, "Error: Invalid group."_jrs);
} }
else else
server->sendMessage(player, "Error: Too few parameters. Syntax: auth <player>"_jrs); server->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"_jrs);
} }
const Jupiter::ReadableString &ATMGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ATMGameCommand::getHelp(const Jupiter::ReadableString &)
@ -1063,31 +1058,31 @@ void ForceAuthGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *playe
{ {
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters); RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, "Error: Player not found."_jrs); source->sendMessage(*player, "Error: Player not found."_jrs);
else if (target == player) else if (target == player)
source->sendMessage(player, "Error: You can not force-authenticate yourself."_jrs); source->sendMessage(*player, "Error: You can not force-authenticate yourself."_jrs);
else else
{ {
int cAccess = pluginInstance.getConfigAccess(target->uuid); int cAccess = pluginInstance.getConfigAccess(target->uuid);
if (cAccess > player->access) if (cAccess > player->access)
source->sendMessage(player, "Error: Can't authenticate higher level moderators."_jrs); source->sendMessage(*player, "Error: Can't authenticate higher level moderators."_jrs);
else if (target->access == cAccess) else if (target->access == cAccess)
source->sendMessage(player, "Error: Player is already authenticated"_jrs); source->sendMessage(*player, "Error: Player is already authenticated"_jrs);
else if (target->access > cAccess) else if (target->access > cAccess)
source->sendMessage(player, "Error: Player is already temporarily authenticated."_jrs); source->sendMessage(*player, "Error: Player is already temporarily authenticated."_jrs);
else else
{ {
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup(); RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
pluginInstance.auth(source, player, false, true); pluginInstance.auth(*source, *player, false, true);
if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs))) if (defaultGroup->name.equals(player->varData[pluginInstance.getName()].get("Group"_jrs)))
source->sendMessage(player, "Error: Failed to authenticate player."_jrs); source->sendMessage(*player, "Error: Failed to authenticate player."_jrs);
else else
source->sendMessage(player, "Player authenticated successfully."_jrs); source->sendMessage(*player, "Player authenticated successfully."_jrs);
} }
} }
} }
else else
source->sendMessage(player, "Error: Too few parameters. Syntax: fauth <player>"_jrs); source->sendMessage(*player, "Error: Too few parameters. Syntax: fauth <player>"_jrs);
} }
const Jupiter::ReadableString &ForceAuthGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ForceAuthGameCommand::getHelp(const Jupiter::ReadableString &)

28
RenX.ModSystem/RenX_ModSystem.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -19,10 +19,10 @@
#if !defined _RENX_MODSYSTEM_H_HEADER #if !defined _RENX_MODSYSTEM_H_HEADER
#define _RENX_MODSYSTEM_H_HEADER #define _RENX_MODSYSTEM_H_HEADER
#include <list>
#include "Jupiter/Plugin.h" #include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h" #include "Jupiter/Reference_String.h"
#include "Jupiter/String.h" #include "Jupiter/String.h"
#include "Jupiter/DLList.h"
#include "IRC_Command.h" #include "IRC_Command.h"
#include "RenX_Plugin.h" #include "RenX_Plugin.h"
#include "RenX_GameCommand.h" #include "RenX_GameCommand.h"
@ -43,7 +43,7 @@ public:
Jupiter::StringS gamePrefix; Jupiter::StringS gamePrefix;
Jupiter::StringS name; Jupiter::StringS name;
}; };
Jupiter::DLList<ModGroup> groups; std::list<ModGroup> groups;
/** /**
* @brief Calls resetAccess() on all players in a server. * @brief Calls resetAccess() on all players in a server.
@ -51,7 +51,7 @@ public:
* @param server Server with players to logout * @param server Server with players to logout
* @return Number of players effected. * @return Number of players effected.
*/ */
unsigned int logoutAllMods(const RenX::Server *server); unsigned int logoutAllMods(RenX::Server &server);
/** /**
* @brief Resets a player's access level to their administrative tag's assosciated access. * @brief Resets a player's access level to their administrative tag's assosciated access.
@ -60,7 +60,7 @@ public:
* @param player Player to reset access * @param player Player to reset access
* @return True if the player's access level was modified, false otherwise. * @return True if the player's access level was modified, false otherwise.
*/ */
bool resetAccess(RenX::PlayerInfo *player); bool resetAccess(RenX::PlayerInfo &player);
/** /**
* @brief Authenticates a player with their configured administrative group. * @brief Authenticates a player with their configured administrative group.
@ -71,11 +71,11 @@ public:
* @param forceauth (optional) True to bypass locks and authenticate the user based on UUID. * @param forceauth (optional) True to bypass locks and authenticate the user based on UUID.
* @return New access of the user, -1 if the user is kicked. * @return New access of the user, -1 if the user is kicked.
*/ */
int auth(RenX::Server *server, const RenX::PlayerInfo *player, bool checkAuto = false, bool forceAuth = false) const; int auth(RenX::Server &server, const RenX::PlayerInfo &player, bool checkAuto = false, bool forceAuth = false) const;
void tempAuth(RenX::Server *server, const RenX::PlayerInfo *player, const ModGroup *group, bool notify = true) const; void tempAuth(RenX::Server &server, const RenX::PlayerInfo &player, const ModGroup *group, bool notify = true) const;
bool set(RenX::PlayerInfo *player, ModGroup *group); bool set(RenX::PlayerInfo &player, ModGroup &group);
int getConfigAccess(const Jupiter::ReadableString &uuid) const; int getConfigAccess(const Jupiter::ReadableString &uuid) const;
size_t getGroupCount() const; size_t getGroupCount() const;
@ -91,14 +91,14 @@ public:
~RenX_ModSystemPlugin(); ~RenX_ModSystemPlugin();
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerCreate(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerDelete(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnIDChange(RenX::Server *server, const RenX::PlayerInfo *player, int oldID) override; void RenX_OnIDChange(RenX::Server &server, const RenX::PlayerInfo &player, int oldID) override;
void RenX_OnAdminLogin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminLogin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAdminGrant(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminGrant(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnAdminLogout(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdminLogout(RenX::Server &server, const RenX::PlayerInfo &player) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
int OnRehash() override; int OnRehash() override;

10
RenX.NicknameUUID/RenX_NicknameUUID.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -23,9 +23,9 @@
#include "RenX_Functions.h" #include "RenX_Functions.h"
#include "RenX_NicknameUUID.h" #include "RenX_NicknameUUID.h"
Jupiter::StringS calc_uuid(RenX::PlayerInfo *player) Jupiter::StringS calc_uuid(RenX::PlayerInfo &player)
{ {
return player->name; return player.name;
} }
RenX_NicknameUUIDPlugin::RenX_NicknameUUIDPlugin() RenX_NicknameUUIDPlugin::RenX_NicknameUUIDPlugin()
@ -44,9 +44,9 @@ RenX_NicknameUUIDPlugin::~RenX_NicknameUUIDPlugin()
core.getServer(--index)->setUUIDFunction(RenX::default_uuid_func); core.getServer(--index)->setUUIDFunction(RenX::default_uuid_func);
} }
void RenX_NicknameUUIDPlugin::RenX_OnServerCreate(RenX::Server *server) void RenX_NicknameUUIDPlugin::RenX_OnServerCreate(RenX::Server &server)
{ {
server->setUUIDFunction(calc_uuid); server.setUUIDFunction(calc_uuid);
} }
// Plugin instantiation and entry point. // Plugin instantiation and entry point.

4
RenX.NicknameUUID/RenX_NicknameUUID.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015-2016 Jessica James. * Copyright (C) 2015-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_NicknameUUIDPlugin : public RenX::Plugin class RenX_NicknameUUIDPlugin : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnServerCreate(RenX::Server *server) override; void RenX_OnServerCreate(RenX::Server &server) override;
public: public:
RenX_NicknameUUIDPlugin(); RenX_NicknameUUIDPlugin();

248
RenX.ServerList/RenX_ServerList.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -215,61 +215,61 @@ constexpr const char *json_bool_as_cstring(bool in)
return in ? "true" : "false"; return in ? "true" : "false";
} }
Jupiter::StringS server_as_json(const RenX::Server *server) Jupiter::StringS server_as_json(const RenX::Server &server)
{ {
Jupiter::String server_json_block(128); Jupiter::String server_json_block(128);
Jupiter::String server_name = jsonify(server->getName()); Jupiter::String server_name = jsonify(server.getName());
Jupiter::String server_map = jsonify(server->getMap().name); Jupiter::String server_map = jsonify(server.getMap().name);
Jupiter::String server_version = jsonify(server->getGameVersion()); Jupiter::String server_version = jsonify(server.getGameVersion());
server_json_block.format(R"json({"Name":"%.*s","Current Map":"%.*s","Bots":%u,"Players":%u,"Game Version":"%.*s","Variables":{"Mine Limit":%d,"bSteamRequired":%s,"bPrivateMessageTeamOnly":%s,"bPassworded":%s,"bAllowPrivateMessaging":%s,"Player Limit":%d,"Vehicle Limit":%d,"bAutoBalanceTeams":%s,"Team Mode":%d,"bSpawnCrates":%s,"CrateRespawnAfterPickup":%f,"Time Limit":%d},"Port":%u,"IP":"%.*s")json", server_json_block.format(R"json({"Name":"%.*s","Current Map":"%.*s","Bots":%u,"Players":%u,"Game Version":"%.*s","Variables":{"Mine Limit":%d,"bSteamRequired":%s,"bPrivateMessageTeamOnly":%s,"bPassworded":%s,"bAllowPrivateMessaging":%s,"Player Limit":%d,"Vehicle Limit":%d,"bAutoBalanceTeams":%s,"Team Mode":%d,"bSpawnCrates":%s,"CrateRespawnAfterPickup":%f,"Time Limit":%d},"Port":%u,"IP":"%.*s")json",
server_name.size(), server_name.ptr(), server_name.size(), server_name.ptr(),
server_map.size(), server_map.ptr(), server_map.size(), server_map.ptr(),
server->getBotCount(), server.getBotCount(),
server->players.size() - server->getBotCount(), server.players.size() - server.getBotCount(),
server_version.size(), server_version.ptr(), server_version.size(), server_version.ptr(),
server->getMineLimit(), server.getMineLimit(),
json_bool_as_cstring(server->isSteamRequired()), json_bool_as_cstring(server.isSteamRequired()),
json_bool_as_cstring(server->isPrivateMessageTeamOnly()), json_bool_as_cstring(server.isPrivateMessageTeamOnly()),
json_bool_as_cstring(server->isPassworded()), json_bool_as_cstring(server.isPassworded()),
json_bool_as_cstring(server->isPrivateMessagingEnabled()), json_bool_as_cstring(server.isPrivateMessagingEnabled()),
server->getPlayerLimit(), server.getPlayerLimit(),
server->getVehicleLimit(), server.getVehicleLimit(),
json_bool_as_cstring(server->getTeamMode() == 3), json_bool_as_cstring(server.getTeamMode() == 3),
server->getTeamMode(), server.getTeamMode(),
json_bool_as_cstring(server->isCratesEnabled()), json_bool_as_cstring(server.isCratesEnabled()),
server->getCrateRespawnDelay(), server.getCrateRespawnDelay(),
server->getTimeLimit(), server.getTimeLimit(),
server->getPort(), server.getPort(),
server->getSocketHostname().size(), server->getSocketHostname().ptr()); server.getSocketHostname().size(), server.getSocketHostname().ptr());
server_json_block += '}'; server_json_block += '}';
return server_json_block; return server_json_block;
} }
Jupiter::StringS server_as_game(const RenX::Server *server) Jupiter::StringS server_as_game(const RenX::Server &server)
{ {
Jupiter::String server_game_block(256); Jupiter::String server_game_block(256);
Jupiter::String server_name = sanitize_game(server->getName()); Jupiter::String server_name = sanitize_game(server.getName());
Jupiter::String server_map = sanitize_game(server->getMap().name); Jupiter::String server_map = sanitize_game(server.getMap().name);
Jupiter::String server_version = sanitize_game(server->getGameVersion()); Jupiter::String server_version = sanitize_game(server.getGameVersion());
Jupiter::String server_levels; Jupiter::String server_levels;
RenX::Map *map; RenX::Map *map;
if (server->maps.size() != 0) if (server.maps.size() != 0)
{ {
map = server->maps.get(0); map = server.maps.get(0);
server_levels = sanitize_game(RenX::formatGUID(*map)); server_levels = sanitize_game(RenX::formatGUID(*map));
server_levels += '='; server_levels += '=';
server_levels += sanitize_game(map->name); server_levels += sanitize_game(map->name);
for (size_t index = 1; index != server->maps.size(); ++index) for (size_t index = 1; index != server.maps.size(); ++index)
{ {
map = server->maps.get(index); map = server.maps.get(index);
server_levels += ';'; server_levels += ';';
server_levels += sanitize_game(RenX::formatGUID(*map)); server_levels += sanitize_game(RenX::formatGUID(*map));
@ -280,40 +280,40 @@ Jupiter::StringS server_as_game(const RenX::Server *server)
server_game_block.format("\n<@>%.*s~%.*s~%u~%s~%.*s~" "%d;%d;%d;%s;%d;%d;%d;%s;%s;%s;%.*s;%s" "~%u~%d~%s~%s~%.*s", server_game_block.format("\n<@>%.*s~%.*s~%u~%s~%.*s~" "%d;%d;%d;%s;%d;%d;%d;%s;%s;%s;%.*s;%s" "~%u~%d~%s~%s~%.*s",
server_name.size(), server_name.ptr(), server_name.size(), server_name.ptr(),
server->getSocketHostname().size(), server->getSocketHostname().ptr(), server.getSocketHostname().size(), server.getSocketHostname().ptr(),
server->getPort(), server.getPort(),
json_bool_as_cstring(server->isPassworded()), json_bool_as_cstring(server.isPassworded()),
server_map.size(), server_map.ptr(), server_map.size(), server_map.ptr(),
//START OPTIONS //START OPTIONS
server->getPlayerLimit(), server.getPlayerLimit(),
server->getVehicleLimit(), server.getVehicleLimit(),
server->getMineLimit(), server.getMineLimit(),
json_bool_as_cstring(server->isCratesEnabled()), json_bool_as_cstring(server.isCratesEnabled()),
server->getGameType(), server.getGameType(),
server->getTeamMode(), server.getTeamMode(),
server->getTimeLimit(), server.getTimeLimit(),
json_bool_as_cstring(server->isPrivateMessagingEnabled()), json_bool_as_cstring(server.isPrivateMessagingEnabled()),
json_bool_as_cstring(server->isPrivateMessageTeamOnly()), json_bool_as_cstring(server.isPrivateMessageTeamOnly()),
json_bool_as_cstring(server->isSteamRequired()), json_bool_as_cstring(server.isSteamRequired()),
server_version.size(), server_version.ptr(), server_version.size(), server_version.ptr(),
json_bool_as_cstring(server->isBotsEnabled()), json_bool_as_cstring(server.isBotsEnabled()),
//END OPTIONS //END OPTIONS
server->players.size() - server->getBotCount(), server.players.size() - server.getBotCount(),
server->getPlayerLimit(), server.getPlayerLimit(),
json_bool_as_cstring(server->isRanked()), json_bool_as_cstring(server.isRanked()),
json_bool_as_cstring(server->isMatchInProgress()), json_bool_as_cstring(server.isMatchInProgress()),
server_levels.size(), server_levels.ptr()); server_levels.size(), server_levels.ptr());
return server_game_block; return server_game_block;
} }
Jupiter::StringS server_as_long_json(const RenX::Server *server) Jupiter::StringS server_as_long_json(const RenX::Server &server)
{ {
Jupiter::String server_json_block(128); Jupiter::String server_json_block(128);
Jupiter::String server_name = jsonify(server->getName()); Jupiter::String server_name = jsonify(server.getName());
Jupiter::String server_map = jsonify(server->getMap().name); Jupiter::String server_map = jsonify(server.getMap().name);
Jupiter::String server_version = jsonify(server->getGameVersion()); Jupiter::String server_version = jsonify(server.getGameVersion());
server_json_block.format(R"json({ server_json_block.format(R"json({
"Name": "%.*s", "Name": "%.*s",
@ -340,44 +340,44 @@ Jupiter::StringS server_as_long_json(const RenX::Server *server)
server_name.size(), server_name.ptr(), server_name.size(), server_name.ptr(),
server_map.size(), server_map.ptr(), server_map.size(), server_map.ptr(),
server->getBotCount(), server.getBotCount(),
server->players.size() - server->getBotCount(), server.players.size() - server.getBotCount(),
server_version.size(), server_version.ptr(), server_version.size(), server_version.ptr(),
server->getMineLimit(), server.getMineLimit(),
json_bool_as_cstring(server->isSteamRequired()), json_bool_as_cstring(server.isSteamRequired()),
json_bool_as_cstring(server->isPrivateMessageTeamOnly()), json_bool_as_cstring(server.isPrivateMessageTeamOnly()),
json_bool_as_cstring(server->isPassworded()), json_bool_as_cstring(server.isPassworded()),
json_bool_as_cstring(server->isPrivateMessagingEnabled()), json_bool_as_cstring(server.isPrivateMessagingEnabled()),
server->getPlayerLimit(), server.getPlayerLimit(),
server->getVehicleLimit(), server.getVehicleLimit(),
json_bool_as_cstring(server->getTeamMode() == 3), json_bool_as_cstring(server.getTeamMode() == 3),
server->getTeamMode(), server.getTeamMode(),
json_bool_as_cstring(server->isCratesEnabled()), json_bool_as_cstring(server.isCratesEnabled()),
server->getCrateRespawnDelay(), server.getCrateRespawnDelay(),
server->getTimeLimit(), server.getTimeLimit(),
server->getPort(), server.getPort(),
server->getSocketHostname().size(), server->getSocketHostname().ptr()); server.getSocketHostname().size(), server.getSocketHostname().ptr());
// Level Rotation // Level Rotation
if (server->maps.size() != 0) if (server.maps.size() != 0)
{ {
server_json_block += ",\n\t\t\"Levels\": ["_jrs; server_json_block += ",\n\t\t\"Levels\": ["_jrs;
server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(server->maps.get(0)->name); server_json_block += jsonify(server.maps.get(0)->name);
server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs; server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs;
server_json_block += RenX::formatGUID(*server->maps.get(0)); server_json_block += RenX::formatGUID(*server.maps.get(0));
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
for (size_t index = 1; index != server->maps.size(); ++index) for (size_t index = 1; index != server.maps.size(); ++index)
{ {
server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(server->maps.get(index)->name); server_json_block += jsonify(server.maps.get(index)->name);
server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs; server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs;
server_json_block += RenX::formatGUID(*server->maps.get(index)); server_json_block += RenX::formatGUID(*server.maps.get(index));
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
} }
@ -385,18 +385,18 @@ Jupiter::StringS server_as_long_json(const RenX::Server *server)
} }
// Mutators // Mutators
if (server->mutators.size() != 0) if (server.mutators.size() != 0)
{ {
server_json_block += ",\n\t\t\"Mutators\": ["_jrs; server_json_block += ",\n\t\t\"Mutators\": ["_jrs;
server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(*server->mutators.get(0)); server_json_block += jsonify(*server.mutators.get(0));
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
for (size_t index = 1; index != server->mutators.size(); ++index) for (size_t index = 1; index != server.mutators.size(); ++index)
{ {
server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(*server->mutators.get(index)); server_json_block += jsonify(*server.mutators.get(index));
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
} }
@ -404,33 +404,34 @@ Jupiter::StringS server_as_long_json(const RenX::Server *server)
} }
// Player List // Player List
if (server->players.size() != 0 && server->players.size() != server->getBotCount()) if (server.players.size() != 0 && server.players.size() != server.getBotCount())
{ {
server_json_block += ",\n\t\t\"PlayerList\": ["_jrs; server_json_block += ",\n\t\t\"PlayerList\": ["_jrs;
size_t index = 0; auto node = server.players.begin();
while (index != server->players.size()) while (node != server.players.end())
{ {
if (server->players.get(index)->isBot == false) if (node->isBot == false)
{ {
server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += "\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(server->players.get(index)->name); server_json_block += jsonify(node->name);
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
++index; ++node;
break; break;
} }
++index;
++node;
} }
while (index != server->players.size()) while (node != server.players.end())
{ {
server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs; server_json_block += ",\n\t\t\t{\n\t\t\t\t\"Name\": \""_jrs;
server_json_block += jsonify(server->players.get(index)->name); server_json_block += jsonify(node->name);
server_json_block += "\"\n\t\t\t}"_jrs; server_json_block += "\"\n\t\t\t}"_jrs;
++index; ++node;
} }
server_json_block += "\n\t\t]"_jrs; server_json_block += "\n\t\t]"_jrs;
@ -441,7 +442,7 @@ Jupiter::StringS server_as_long_json(const RenX::Server *server)
return server_json_block; return server_json_block;
} }
void RenX_ServerListPlugin::addServerToServerList(RenX::Server *server) void RenX_ServerListPlugin::addServerToServerList(RenX::Server &server)
{ {
Jupiter::String server_json_block(256); Jupiter::String server_json_block(256);
@ -480,22 +481,22 @@ void RenX_ServerListPlugin::addServerToServerList(RenX::Server *server)
server_json_block = '{'; server_json_block = '{';
if (server->maps.size() != 0) if (server.maps.size() != 0)
{ {
server_json_block += "\"Levels\":["_jrs; server_json_block += "\"Levels\":["_jrs;
server_json_block += "{\"Name\":\""_jrs; server_json_block += "{\"Name\":\""_jrs;
server_json_block += jsonify(server->maps.get(0)->name); server_json_block += jsonify(server.maps.get(0)->name);
server_json_block += "\",\"GUID\":\""_jrs; server_json_block += "\",\"GUID\":\""_jrs;
server_json_block += RenX::formatGUID(*server->maps.get(0)); server_json_block += RenX::formatGUID(*server.maps.get(0));
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
for (size_t index = 1; index != server->maps.size(); ++index) for (size_t index = 1; index != server.maps.size(); ++index)
{ {
server_json_block += ",{\"Name\":\""_jrs; server_json_block += ",{\"Name\":\""_jrs;
server_json_block += jsonify(server->maps.get(index)->name); server_json_block += jsonify(server.maps.get(index)->name);
server_json_block += "\",\"GUID\":\""_jrs; server_json_block += "\",\"GUID\":\""_jrs;
server_json_block += RenX::formatGUID(*server->maps.get(index)); server_json_block += RenX::formatGUID(*server.maps.get(index));
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
} }
@ -503,20 +504,20 @@ void RenX_ServerListPlugin::addServerToServerList(RenX::Server *server)
} }
// Mutators // Mutators
if (server->mutators.size() != 0) if (server.mutators.size() != 0)
{ {
if (server->maps.size() != 0) if (server.maps.size() != 0)
server_json_block += ","_jrs; server_json_block += ","_jrs;
server_json_block += "\"Mutators\":["_jrs; server_json_block += "\"Mutators\":["_jrs;
server_json_block += "{\"Name\":\""_jrs; server_json_block += "{\"Name\":\""_jrs;
server_json_block += jsonify(*server->mutators.get(0)); server_json_block += jsonify(*server.mutators.get(0));
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
for (size_t index = 1; index != server->mutators.size(); ++index) for (size_t index = 1; index != server.mutators.size(); ++index)
{ {
server_json_block += ",{\"Name\":\""_jrs; server_json_block += ",{\"Name\":\""_jrs;
server_json_block += jsonify(*server->mutators.get(index)); server_json_block += jsonify(*server.mutators.get(index));
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
} }
@ -524,33 +525,34 @@ void RenX_ServerListPlugin::addServerToServerList(RenX::Server *server)
} }
// Player List // Player List
if (server->players.size() != 0 && server->players.size() != server->getBotCount()) if (server.players.size() != 0 && server.players.size() != server.getBotCount())
{ {
server_json_block += ",\"PlayerList\":["_jrs; server_json_block += ",\"PlayerList\":["_jrs;
size_t index = 0; auto node = server.players.begin();
while (index != server->players.size()) while (node != server.players.end())
{ {
if (server->players.get(index)->isBot == false) if (node->isBot == false)
{ {
server_json_block += "{\"Name\":\""_jrs; server_json_block += "{\"Name\":\""_jrs;
server_json_block += jsonify(server->players.get(index)->name); server_json_block += jsonify(node->name);
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
++index; ++node;
break; break;
} }
++index;
++node;
} }
while (index != server->players.size()) while (node != server.players.end())
{ {
server_json_block += ",{\"Name\":\""_jrs; server_json_block += ",{\"Name\":\""_jrs;
server_json_block += jsonify(server->players.get(index)->name); server_json_block += jsonify(node->name);
server_json_block += "\"}"_jrs; server_json_block += "\"}"_jrs;
++index; ++node;
} }
server_json_block += "]"_jrs; server_json_block += "]"_jrs;
@ -558,7 +560,7 @@ void RenX_ServerListPlugin::addServerToServerList(RenX::Server *server)
server_json_block += '}'; server_json_block += '}';
server->varData[this->name].set("j"_jrs, server_json_block); server.varData[this->name].set("j"_jrs, server_json_block);
} }
void RenX_ServerListPlugin::updateServerList() void RenX_ServerListPlugin::updateServerList()
@ -577,8 +579,8 @@ void RenX_ServerListPlugin::updateServerList()
server = servers.get(index); server = servers.get(index);
if (server->isConnected() && server->isFullyConnected()) if (server->isConnected() && server->isFullyConnected())
{ {
RenX_ServerListPlugin::server_list_json += server_as_json(server); RenX_ServerListPlugin::server_list_json += server_as_json(*server);
RenX_ServerListPlugin::server_list_game += server_as_game(server); RenX_ServerListPlugin::server_list_game += server_as_game(*server);
++index; ++index;
break; break;
@ -591,9 +593,9 @@ void RenX_ServerListPlugin::updateServerList()
if (server->isConnected() && server->isFullyConnected()) if (server->isConnected() && server->isFullyConnected())
{ {
RenX_ServerListPlugin::server_list_json += ','; RenX_ServerListPlugin::server_list_json += ',';
RenX_ServerListPlugin::server_list_json += server_as_json(server); RenX_ServerListPlugin::server_list_json += server_as_json(*server);
RenX_ServerListPlugin::server_list_game += server_as_game(server); RenX_ServerListPlugin::server_list_game += server_as_game(*server);
} }
++index; ++index;
} }
@ -602,31 +604,31 @@ void RenX_ServerListPlugin::updateServerList()
RenX_ServerListPlugin::server_list_game += server_list_game_footer; RenX_ServerListPlugin::server_list_game += server_list_game_footer;
} }
void RenX_ServerListPlugin::RenX_OnServerFullyConnected(RenX::Server *server) void RenX_ServerListPlugin::RenX_OnServerFullyConnected(RenX::Server &server)
{ {
this->addServerToServerList(server); this->addServerToServerList(server);
} }
void RenX_ServerListPlugin::RenX_OnServerDisconnect(RenX::Server *server, RenX::DisconnectReason) void RenX_ServerListPlugin::RenX_OnServerDisconnect(RenX::Server &server, RenX::DisconnectReason)
{ {
this->updateServerList(); this->updateServerList();
// remove from individual listing // remove from individual listing
server->varData[this->name].remove("j"_jrs); server.varData[this->name].remove("j"_jrs);
} }
void RenX_ServerListPlugin::RenX_OnJoin(RenX::Server *, const RenX::PlayerInfo *) void RenX_ServerListPlugin::RenX_OnJoin(RenX::Server &, const RenX::PlayerInfo &)
{ {
this->updateServerList(); this->updateServerList();
} }
void RenX_ServerListPlugin::RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *) void RenX_ServerListPlugin::RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &)
{ {
if (server->isTravelling() == false || server->isSeamless()) if (server.isTravelling() == false || server.isSeamless())
this->updateServerList(); this->updateServerList();
} }
void RenX_ServerListPlugin::RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) void RenX_ServerListPlugin::RenX_OnMapLoad(RenX::Server &server, const Jupiter::ReadableString &map)
{ {
this->updateServerList(); this->updateServerList();
} }
@ -656,7 +658,7 @@ Jupiter::ReadableString *handle_server_list_long_page(const Jupiter::ReadableStr
if (server->isConnected() && server->isFullyConnected()) if (server->isConnected() && server->isFullyConnected())
{ {
*server_list_long_json += "\n\t"_jrs; *server_list_long_json += "\n\t"_jrs;
*server_list_long_json += server_as_long_json(server); *server_list_long_json += server_as_long_json(*server);
++index; ++index;
break; break;
} }
@ -668,7 +670,7 @@ Jupiter::ReadableString *handle_server_list_long_page(const Jupiter::ReadableStr
if (server->isConnected() && server->isFullyConnected()) if (server->isConnected() && server->isFullyConnected())
{ {
*server_list_long_json += ",\n\t"_jrs; *server_list_long_json += ",\n\t"_jrs;
*server_list_long_json += server_as_long_json(server); *server_list_long_json += server_as_long_json(*server);
} }
++index; ++index;
} }

14
RenX.ServerList/RenX_ServerList.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2016 Jessica James. * Copyright (C) 2016-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,18 +29,18 @@ public: // RenX_ServerListPlugin
Jupiter::ReadableString *getServerListJSON(); Jupiter::ReadableString *getServerListJSON();
Jupiter::ReadableString *getServerListGame(); Jupiter::ReadableString *getServerListGame();
void addServerToServerList(RenX::Server *server); void addServerToServerList(RenX::Server &server);
void updateServerList(); void updateServerList();
virtual bool initialize() override; virtual bool initialize() override;
~RenX_ServerListPlugin(); ~RenX_ServerListPlugin();
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnServerFullyConnected(RenX::Server *server) override; void RenX_OnServerFullyConnected(RenX::Server &server) override;
void RenX_OnServerDisconnect(RenX::Server *server, RenX::DisconnectReason reason) override; void RenX_OnServerDisconnect(RenX::Server &server, RenX::DisconnectReason reason) override;
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player) override;
void RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) override; void RenX_OnMapLoad(RenX::Server &server, const Jupiter::ReadableString &map) override;
private: private:
Jupiter::StringS server_list_json, server_list_game; Jupiter::StringS server_list_json, server_list_game;

38
RenX.SetJoin/RenX_SetJoin.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -23,13 +23,13 @@
using namespace Jupiter::literals; using namespace Jupiter::literals;
void RenX_SetJoinPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_SetJoinPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player)
{ {
if (player->uuid.isNotEmpty() && server->isMatchInProgress()) if (player.uuid.isNotEmpty() && server.isMatchInProgress())
{ {
const Jupiter::ReadableString &setjoin = RenX_SetJoinPlugin::setjoin_file.get(player->uuid); const Jupiter::ReadableString &setjoin = RenX_SetJoinPlugin::setjoin_file.get(player.uuid);
if (setjoin.isNotEmpty()) if (setjoin.isNotEmpty())
server->sendMessage(Jupiter::StringS::Format("[%.*s] %.*s", player->name.size(), player->name.ptr(), setjoin.size(), setjoin.ptr())); server.sendMessage(Jupiter::StringS::Format("[%.*s] %.*s", player.name.size(), player.name.ptr(), setjoin.size(), setjoin.ptr()));
} }
} }
@ -49,11 +49,14 @@ void ViewJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
if (player->uuid.isNotEmpty()) if (player->uuid.isNotEmpty())
{ {
const Jupiter::ReadableString &setjoin = pluginInstance.setjoin_file.get(player->uuid); const Jupiter::ReadableString &setjoin = pluginInstance.setjoin_file.get(player->uuid);
if (setjoin.isNotEmpty()) if (setjoin.isNotEmpty())
source->sendMessage(player, Jupiter::StringS::Format("[%.*s] %.*s", player->name.size(), player->name.ptr(), setjoin.size(), setjoin.ptr())); source->sendMessage(*player, Jupiter::StringS::Format("[%.*s] %.*s", player->name.size(), player->name.ptr(), setjoin.size(), setjoin.ptr()));
else source->sendMessage(player, "Error: No setjoin found."_jrs); else
source->sendMessage(*player, "Error: No setjoin found."_jrs);
} }
else source->sendMessage(player, "Error: A setjoin message requires steam."_jrs); else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
} }
const Jupiter::ReadableString &ViewJoinGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ViewJoinGameCommand::getHelp(const Jupiter::ReadableString &)
@ -77,11 +80,14 @@ void ShowJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
if (player->uuid.isNotEmpty()) if (player->uuid.isNotEmpty())
{ {
const Jupiter::ReadableString &setjoin = pluginInstance.setjoin_file.get(player->uuid); const Jupiter::ReadableString &setjoin = pluginInstance.setjoin_file.get(player->uuid);
if (setjoin.isNotEmpty()) if (setjoin.isNotEmpty())
source->sendMessage(Jupiter::StringS::Format("[%.*s] %.*s", player->name.size(), player->name.ptr(), setjoin.size(), setjoin.ptr())); source->sendMessage(Jupiter::StringS::Format("[%.*s] %.*s", player->name.size(), player->name.ptr(), setjoin.size(), setjoin.ptr()));
else source->sendMessage(player, "Error: No setjoin found."_jrs); else
source->sendMessage(*player, "Error: No setjoin found."_jrs);
} }
else source->sendMessage(player, "Error: A setjoin message requires steam."_jrs); else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
} }
const Jupiter::ReadableString &ShowJoinGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ShowJoinGameCommand::getHelp(const Jupiter::ReadableString &)
@ -107,10 +113,12 @@ void DelJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (player->uuid.isNotEmpty()) if (player->uuid.isNotEmpty())
{ {
if (pluginInstance.setjoin_file.remove(player->uuid)) if (pluginInstance.setjoin_file.remove(player->uuid))
source->sendMessage(player, Jupiter::StringS::Format("%.*s, your join message has been removed.", player->name.size(), player->name.ptr())); source->sendMessage(*player, Jupiter::StringS::Format("%.*s, your join message has been removed.", player->name.size(), player->name.ptr()));
else source->sendMessage(player, "Error: Setjoin not found."_jrs); else
source->sendMessage(*player, "Error: Setjoin not found."_jrs);
} }
else source->sendMessage(player, "Error: A setjoin message requires steam."_jrs); else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
} }
const Jupiter::ReadableString &DelJoinGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &DelJoinGameCommand::getHelp(const Jupiter::ReadableString &)
@ -137,11 +145,11 @@ void SetJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
{ {
pluginInstance.setjoin_file.set(player->uuid, parameters); pluginInstance.setjoin_file.set(player->uuid, parameters);
pluginInstance.setjoin_file.write(); pluginInstance.setjoin_file.write();
source->sendMessage(player, Jupiter::StringS::Format("%.*s, your join message is now: %.*s", player->name.size(), player->name.ptr(), parameters.size(), parameters.ptr())); source->sendMessage(*player, Jupiter::StringS::Format("%.*s, your join message is now: %.*s", player->name.size(), player->name.ptr(), parameters.size(), parameters.ptr()));
} }
else DelJoinGameCommand_instance.trigger(source, player, parameters); else DelJoinGameCommand_instance.trigger(source, player, parameters);
} }
else source->sendMessage(player, "Error: A setjoin message requires steam."_jrs); else source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
} }
const Jupiter::ReadableString &SetJoinGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &SetJoinGameCommand::getHelp(const Jupiter::ReadableString &)

4
RenX.SetJoin/RenX_SetJoin.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,7 +29,7 @@ public:
Jupiter::Config &setjoin_file = Jupiter::Plugin::config; Jupiter::Config &setjoin_file = Jupiter::Plugin::config;
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) override;
}; };
GENERIC_GAME_COMMAND(SetJoinGameCommand) GENERIC_GAME_COMMAND(SetJoinGameCommand)

28
RenX.Warn/RenX_Warn.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2014-2016 Jessica James. * Copyright (C) 2014-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -76,11 +76,11 @@ void WarnIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
switch (pluginInstance.warnAction) switch (pluginInstance.warnAction)
{ {
case -1: case -1:
server->kickPlayer(player, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns)); server->kickPlayer(*player, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns));
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.ptr(), warns)); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.ptr(), warns));
break; break;
default: default:
server->banPlayer(player, "Jupiter Bot/RenX.Warn"_jrs, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.warnAction)); server->banPlayer(*player, "Jupiter Bot/RenX.Warn"_jrs, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.warnAction));
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.ptr(), warns)); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.ptr(), warns));
break; break;
} }
@ -88,7 +88,7 @@ void WarnIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
else else
{ {
player->varData[pluginInstance.getName()].set(WARNS_KEY, Jupiter::StringS::Format("%d", warns)); player->varData[pluginInstance.getName()].set(WARNS_KEY, Jupiter::StringS::Format("%d", warns));
server->sendMessage(player, Jupiter::StringS::Format("You have been warned by %.*s@IRC; improve your behavior, or you will be disciplined. You have %d warnings.", nick.size(), nick.ptr(), warns)); server->sendMessage(*player, Jupiter::StringS::Format("You have been warned by %.*s@IRC; improve your behavior, or you will be disciplined. You have %d warnings.", nick.size(), nick.ptr(), warns));
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been warned; they now have %d warnings.", player->name.size(), player->name.ptr(), warns)); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been warned; they now have %d warnings.", player->name.size(), player->name.ptr(), warns));
} }
} }
@ -142,7 +142,7 @@ void PardonIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
if (player != nullptr) if (player != nullptr)
{ {
player->varData[pluginInstance.getName()].remove(WARNS_KEY); player->varData[pluginInstance.getName()].remove(WARNS_KEY);
server->sendMessage(player, Jupiter::StringS::Format("You have been pardoned by %.*s@IRC; your warnings have been reset.", nick.size(), nick.ptr())); server->sendMessage(*player, Jupiter::StringS::Format("You have been pardoned by %.*s@IRC; your warnings have been reset.", nick.size(), nick.ptr()));
source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been pardoned; their warnings have been reset.", player->name.size(), player->name.ptr())); source->sendNotice(nick, Jupiter::StringS::Format("%.*s has been pardoned; their warnings have been reset.", player->name.size(), player->name.ptr()));
} }
} }
@ -186,25 +186,25 @@ void WarnGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
switch (pluginInstance.warnAction) switch (pluginInstance.warnAction)
{ {
case -1: case -1:
source->kickPlayer(target, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns)); source->kickPlayer(*target, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns));
source->sendMessage(player, Jupiter::StringS::Format("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.ptr(), warns)); source->sendMessage(*player, Jupiter::StringS::Format("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.ptr(), warns));
break; break;
default: default:
source->banPlayer(target, "Jupiter Bot/RenX.Warn"_jrs, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.warnAction)); source->banPlayer(*target, "Jupiter Bot/RenX.Warn"_jrs, Jupiter::StringS::Format("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.warnAction));
source->sendMessage(player, Jupiter::StringS::Format("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.ptr(), warns)); source->sendMessage(*player, Jupiter::StringS::Format("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.ptr(), warns));
break; break;
} }
} }
else else
{ {
target->varData[pluginInstance.getName()].set(WARNS_KEY, Jupiter::StringS::Format("%d", warns)); target->varData[pluginInstance.getName()].set(WARNS_KEY, Jupiter::StringS::Format("%d", warns));
source->sendMessage(target, Jupiter::StringS::Format("You have been warned by %.*s; improve your behavior, or you will be disciplined. You have %d warnings.", player->name.size(), player->name.ptr(), warns)); source->sendMessage(*target, Jupiter::StringS::Format("You have been warned by %.*s; improve your behavior, or you will be disciplined. You have %d warnings.", player->name.size(), player->name.ptr(), warns));
source->sendMessage(player, Jupiter::StringS::Format("%.*s has been warned; they now have %d warnings.", target->name.size(), target->name.ptr(), warns)); source->sendMessage(*player, Jupiter::StringS::Format("%.*s has been warned; they now have %d warnings.", target->name.size(), target->name.ptr(), warns));
} }
} }
} }
else else
source->sendMessage(player, "Error: Too few parameters. Syntax: Warn <Player>"_jrs); source->sendMessage(*player, "Error: Too few parameters. Syntax: Warn <Player>"_jrs);
} }
const Jupiter::ReadableString &WarnGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &WarnGameCommand::getHelp(const Jupiter::ReadableString &)
@ -233,8 +233,8 @@ void PardonGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (target != nullptr) if (target != nullptr)
{ {
target->varData[pluginInstance.getName()].remove(WARNS_KEY); target->varData[pluginInstance.getName()].remove(WARNS_KEY);
source->sendMessage(target, Jupiter::StringS::Format("You have been pardoned by %.*s@IRC; your warnings have been reset.", player->name.size(), player->name.ptr())); source->sendMessage(*target, Jupiter::StringS::Format("You have been pardoned by %.*s@IRC; your warnings have been reset.", player->name.size(), player->name.ptr()));
source->sendMessage(player, Jupiter::StringS::Format("%.*s has been pardoned; their warnings have been reset.", target->name.size(), target->name.ptr())); source->sendMessage(*player, Jupiter::StringS::Format("%.*s has been pardoned; their warnings have been reset.", target->name.size(), target->name.ptr()));
} }
} }
else else

Loading…
Cancel
Save