Browse Source

Remove all Jupiter string usage; update submodule; various minor fixes

master
Jessica James 3 years ago
parent
commit
96530d778e
  1. 1
      src/Bot/include/Console_Command.h
  2. 2
      src/Bot/include/IRC_Bot.h
  3. 1
      src/Bot/include/IRC_Command.h
  4. 2
      src/Bot/include/ServerManager.h
  5. 12
      src/Bot/src/IRC_Bot.cpp
  6. 11
      src/Bot/src/Main.cpp
  7. 6
      src/Bot/src/ServerManager.cpp
  8. 2
      src/Jupiter
  9. 6
      src/Plugins/ChannelRelay/ChannelRelay.cpp
  10. 1
      src/Plugins/ChannelRelay/ChannelRelay.h
  11. 37
      src/Plugins/CoreCommands/CoreCommands.cpp
  12. 122
      src/Plugins/ExtraCommands/ExtraCommands.cpp
  13. 107
      src/Plugins/FunCommands/FunCommands.cpp
  14. 15
      src/Plugins/HTTPServer/HTTPServer.cpp
  15. 2
      src/Plugins/HTTPServer/HTTPServer.h
  16. 5
      src/Plugins/IRC.Core/IRC_Core.cpp
  17. 1
      src/Plugins/IRC.Core/IRC_Core.h
  18. 9
      src/Plugins/Plugin.Example/Example.cpp
  19. 1
      src/Plugins/Plugin.Template/Example.h
  20. 45
      src/Plugins/PluginManager/PluginManager.cpp
  21. 7
      src/Plugins/RenX/RenX.AlwaysRecord/RenX_AlwaysRecord.cpp
  22. 1
      src/Plugins/RenX/RenX.AlwaysRecord/RenX_AlwaysRecord.h
  23. 3
      src/Plugins/RenX/RenX.Announcements/RenX_Announcements.cpp
  24. 2
      src/Plugins/RenX/RenX.Announcements/RenX_Announcements.h
  25. 1
      src/Plugins/RenX/RenX.ChatLogging/RenX_ChatLogging.h
  26. 29
      src/Plugins/RenX/RenX.CommandLogging/RenX_CommandLogging.cpp
  27. 1
      src/Plugins/RenX/RenX.CommandLogging/RenX_CommandLogging.h
  28. 1105
      src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp
  29. 23
      src/Plugins/RenX/RenX.Core/RenX_BanDatabase.cpp
  30. 3
      src/Plugins/RenX/RenX.Core/RenX_BanDatabase.h
  31. 1
      src/Plugins/RenX/RenX.Core/RenX_BuildingInfo.h
  32. 10
      src/Plugins/RenX/RenX.Core/RenX_Core.cpp
  33. 7
      src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.cpp
  34. 1
      src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.h
  35. 625
      src/Plugins/RenX/RenX.Core/RenX_Functions.cpp
  36. 7
      src/Plugins/RenX/RenX.Core/RenX_Functions.h
  37. 8
      src/Plugins/RenX/RenX.Core/RenX_GameCommand.cpp
  38. 1
      src/Plugins/RenX/RenX.Core/RenX_GameCommand.h
  39. 14
      src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.cpp
  40. 1
      src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.h
  41. 2
      src/Plugins/RenX/RenX.Core/RenX_Map.h
  42. 14
      src/Plugins/RenX/RenX.Core/RenX_PlayerInfo.h
  43. 2
      src/Plugins/RenX/RenX.Core/RenX_Plugin.cpp
  44. 3
      src/Plugins/RenX/RenX.Core/RenX_Plugin.h
  45. 501
      src/Plugins/RenX/RenX.Core/RenX_Server.cpp
  46. 16
      src/Plugins/RenX/RenX.Core/RenX_Server.h
  47. 360
      src/Plugins/RenX/RenX.Core/RenX_Tags.cpp
  48. 1
      src/Plugins/RenX/RenX.Core/RenX_Tags.h
  49. 3
      src/Plugins/RenX/RenX.Core/RenX_TeamInfo.h
  50. 13
      src/Plugins/RenX/RenX.ExcessiveHeadshots/RenX_ExcessiveHeadshots.cpp
  51. 12
      src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.cpp
  52. 1
      src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.h
  53. 1
      src/Plugins/RenX/RenX.Greetings/RenX_Greetings.cpp
  54. 2
      src/Plugins/RenX/RenX.Greetings/RenX_Greetings.h
  55. 4
      src/Plugins/RenX/RenX.HybridUUID/RenX_HybridUUID.cpp
  56. 1
      src/Plugins/RenX/RenX.HybridUUID/RenX_HybridUUID.h
  57. 82
      src/Plugins/RenX/RenX.IRCJoin/RenX_IRCJoin.cpp
  58. 13
      src/Plugins/RenX/RenX.IRCJoin/RenX_IRCJoin.h
  59. 3
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp
  60. 1
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h
  61. 17
      src/Plugins/RenX/RenX.Ladder.All-Time/RenX_Ladder_All_Time.cpp
  62. 1
      src/Plugins/RenX/RenX.Ladder.All-Time/RenX_Ladder_All_Time.h
  63. 23
      src/Plugins/RenX/RenX.Ladder.Daily/RenX_Ladder_Daily.cpp
  64. 1
      src/Plugins/RenX/RenX.Ladder.Daily/RenX_Ladder_Daily.h
  65. 20
      src/Plugins/RenX/RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp
  66. 1
      src/Plugins/RenX/RenX.Ladder.Monthly/RenX_Ladder_Monthly.h
  67. 104
      src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.cpp
  68. 8
      src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.h
  69. 26
      src/Plugins/RenX/RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp
  70. 1
      src/Plugins/RenX/RenX.Ladder.Weekly/RenX_Ladder_Weekly.h
  71. 23
      src/Plugins/RenX/RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp
  72. 1
      src/Plugins/RenX/RenX.Ladder.Yearly/RenX_Ladder_Yearly.h
  73. 39
      src/Plugins/RenX/RenX.Ladder/RenX_Ladder.cpp
  74. 1
      src/Plugins/RenX/RenX.Ladder/RenX_Ladder.h
  75. 14
      src/Plugins/RenX/RenX.Listen/RenX_Listen.cpp
  76. 1
      src/Plugins/RenX/RenX.Listen/RenX_Listen.h
  77. 412
      src/Plugins/RenX/RenX.Logging/RenX_Logging.cpp
  78. 117
      src/Plugins/RenX/RenX.Medals/RenX_Medals.cpp
  79. 15
      src/Plugins/RenX/RenX.Medals/RenX_Medals.h
  80. 82
      src/Plugins/RenX/RenX.MinPlayers/RenX_MinPlayers.cpp
  81. 1
      src/Plugins/RenX/RenX.MinPlayers/RenX_MinPlayers.h
  82. 318
      src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.cpp
  83. 2
      src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.h
  84. 3
      src/Plugins/RenX/RenX.NicknameUUID/RenX_NicknameUUID.cpp
  85. 1
      src/Plugins/RenX/RenX.NicknameUUID/RenX_NicknameUUID.h
  86. 1
      src/Plugins/RenX/RenX.Plugin.Template/Example.h
  87. 34
      src/Plugins/RenX/RenX.Relay/RenX_Relay.cpp
  88. 1
      src/Plugins/RenX/RenX.Relay/RenX_Relay.h
  89. 161
      src/Plugins/RenX/RenX.ServerList/RenX_ServerList.cpp
  90. 5
      src/Plugins/RenX/RenX.ServerList/RenX_ServerList.h
  91. 44
      src/Plugins/RenX/RenX.SetJoin/RenX_SetJoin.cpp
  92. 48
      src/Plugins/RenX/RenX.Warn/RenX_Warn.cpp
  93. 1
      src/Plugins/RenX/RenX.Warn/RenX_Warn.h
  94. 60
      src/Plugins/SetJoin/SetJoin.cpp

1
src/Bot/include/Console_Command.h

@ -24,6 +24,7 @@
* @brief Provides an extendable command system specialized for console-based commands.
*/
#include <iostream>
#include "Jupiter/GenericCommand.h"
#include "Jupiter_Bot.h"

2
src/Bot/include/IRC_Bot.h

@ -24,10 +24,10 @@
* @brief Provides extendable bot-like interfacing with the IRC client.
*/
#include <vector>
#include "Jupiter_Bot.h"
#include "Jupiter/IRC_Client.h"
#include "Jupiter/Rehash.h"
#include "Jupiter/String.hpp"
/** Forward Declaration */
class IRCCommand;

1
src/Bot/include/IRC_Command.h

@ -26,7 +26,6 @@
#include "Jupiter/GenericCommand.h"
#include "Jupiter/IRC_Client.h"
#include "Jupiter/String.hpp"
#include "Jupiter_Bot.h"
#include "ServerManager.h"
#include "IRC_Bot.h"

2
src/Bot/include/ServerManager.h

@ -25,9 +25,9 @@
*/
#include <memory>
#include <vector>
#include "Jupiter_Bot.h"
#include "Jupiter/Thinker.h"
#include "Jupiter/Readable_String.h"
/** Forward declarations */
class IRC_Bot;

12
src/Bot/src/IRC_Bot.cpp

@ -24,15 +24,15 @@
#include "Jupiter/Config.h"
#include "Jupiter/Plugin.h"
#include "Jupiter/Functions.h"
#include "Jupiter/Readable_String.h"
#include "IRC_Bot.h"
#include "IRC_Command.h"
using namespace Jupiter::literals;
using namespace std::literals;
IRC_Bot::IRC_Bot(Jupiter::Config *in_primary_section, Jupiter::Config *in_secondary_section)
: Client(in_primary_section, in_secondary_section) {
m_commandPrefix = this->readConfigValue("Prefix"_jrs);
m_commandPrefix = this->readConfigValue("Prefix"sv);
for (const auto& command : IRCMasterCommandList) {
m_commands.emplace_back(command->copy());
@ -105,14 +105,14 @@ void IRC_Bot::setCommandAccessLevels(IRCCommand *in_command) {
return;
}
Jupiter::Config *section = in_section->getSection("Commands"_jrs);
Jupiter::Config *section = in_section->getSection("Commands"sv);
if (section == nullptr) {
return;
}
for (auto& entry : section->getTable()) {
size_t tmp_index;
Jupiter::ReferenceString tmp_key, tmp_sub_key;
std::string_view tmp_key, tmp_sub_key;
IRCCommand *command;
tmp_index = entry.first.find('.');
@ -174,10 +174,10 @@ void IRC_Bot::OnChat(std::string_view in_channel, std::string_view nick, std::st
IRCCommand::active_server = this;
int command_access = cmd->getAccessLevel(channel);
if (command_access < 0) {
this->sendNotice(nick, "Error: Command disabled."_jrs);
this->sendNotice(nick, "Error: Command disabled."sv);
}
else if (Jupiter::IRC::Client::getAccessLevel(*channel, nick) < command_access) {
this->sendNotice(nick, "Access Denied."_jrs);
this->sendNotice(nick, "Access Denied."sv);
}
else {
cmd->trigger(this, in_channel, nick, message_split.second);

11
src/Bot/src/Main.cpp

@ -39,7 +39,6 @@
#include <Windows.h>
#endif // _WIN32
using namespace Jupiter::literals;
using namespace std::literals;
Jupiter::INIConfig o_config;
@ -91,13 +90,13 @@ void inputLoop() {
void initialize_plugins() {
std::cout << "Loading plugins..." << std::endl;
std::string_view plugin_list_str = Jupiter::g_config->get("Plugins"_jrs);
std::string_view plugin_list_str = Jupiter::g_config->get("Plugins"sv);
if (plugin_list_str.empty()) {
std::cout << "No plugins to load!" << std::endl;
}
else {
// initialize plugins
auto plugin_names = jessilib::word_split<std::vector, Jupiter::ReferenceString>(plugin_list_str, WHITESPACE_SV);
auto plugin_names = jessilib::word_split_view(plugin_list_str, WHITESPACE_SV);
std::cout << "Attempting to load " << plugin_names.size() << " plugins..." << std::endl;
for (const auto& plugin_name : plugin_names) {
@ -206,10 +205,10 @@ int main(int argc, char* argv[]) {
printf("Config loaded (%fms)." ENDL, time_taken);
if (plugins_directory.empty())
plugins_directory = o_config.get("PluginsDirectory"_jrs);
plugins_directory = o_config.get("PluginsDirectory"sv);
if (configs_directory.empty())
configs_directory = o_config.get("ConfigsDirectory"_jrs);
configs_directory = o_config.get("ConfigsDirectory"sv);
if (!plugins_directory.empty()) {
Jupiter::Plugin::setDirectory(plugins_directory);
@ -226,7 +225,7 @@ int main(int argc, char* argv[]) {
printf("Initialization completed in %f milliseconds." ENDL, static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - Jupiter::g_start_time).count()) / 1000.0 );
if (!consoleCommands.empty()) {
printf("%zu Console Commands have been initialized%s" ENDL, consoleCommands.size(), getConsoleCommand("help"_jrs) == nullptr ? "." : "; type \"help\" for more information.");
printf("%zu Console Commands have been initialized%s" ENDL, consoleCommands.size(), getConsoleCommand("help"sv) == nullptr ? "." : "; type \"help\" for more information.");
}
if (!IRCMasterCommandList.empty()) {
printf("%zu IRC Commands have been loaded into the master list." ENDL, IRCMasterCommandList.size());

6
src/Bot/src/ServerManager.cpp

@ -22,7 +22,7 @@
#include "IRC_Bot.h"
#include "IRC_Command.h"
using namespace Jupiter::literals;
using namespace std::literals;
ServerManager g_serverManager;
ServerManager *serverManager = &g_serverManager;
@ -72,7 +72,7 @@ size_t ServerManager::removeCommand(std::string_view command) {
void ServerManager::OnConfigRehash() {
for (const auto& server : m_servers) {
server->setPrimaryConfigSection(m_config->getSection(server->getConfigSection()));
server->setSecondaryConfigSection(m_config->getSection("Defualt"_jrs));
server->setSecondaryConfigSection(m_config->getSection("Defualt"sv));
server->setCommandAccessLevels();
}
}
@ -104,7 +104,7 @@ IRC_Bot *ServerManager::getServer(size_t serverIndex) {
}
bool ServerManager::addServer(std::string_view serverConfig) {
auto server = std::make_unique<IRC_Bot>(m_config->getSection(serverConfig), m_config->getSection("Default"_jrs));
auto server = std::make_unique<IRC_Bot>(m_config->getSection(serverConfig), m_config->getSection("Default"sv));
if (server->connect()) {
m_servers.push_back(std::move(server));
return true;

2
src/Jupiter

@ -1 +1 @@
Subproject commit 273bb80abfe378654d6f3f2b7a1eeaab2549faaf
Subproject commit 77762980cce5bda4035b15cc552ec8a4c5b2175e

6
src/Plugins/ChannelRelay/ChannelRelay.cpp

@ -18,16 +18,16 @@
#include "jessilib/word_split.hpp"
#include "Jupiter/IRC_Client.h"
#include "Jupiter/String.hpp"
#include "Jupiter/Functions.h"
#include "Jupiter/Readable_String.h"
#include "ServerManager.h"
#include "IRC_Bot.h"
#include "ChannelRelay.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool ChannelRelayPlugin::initialize() {
std::string_view types_string = this->config.get("Types"_jrs);
std::string_view types_string = this->config.get("Types"sv);
std::vector<std::string_view> split_types = jessilib::word_split_view(types_string, WHITESPACE_SV);
if (split_types.empty()) {

1
src/Plugins/ChannelRelay/ChannelRelay.h

@ -20,7 +20,6 @@
#define _CHANNELRELAY_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
class ChannelRelayPlugin : public Jupiter::Plugin
{

37
src/Plugins/CoreCommands/CoreCommands.cpp

@ -22,13 +22,12 @@
#include "CoreCommands.h"
#include "IRC_Bot.h"
using namespace Jupiter::literals;
using namespace std::literals;
// Help Console Command
HelpConsoleCommand::HelpConsoleCommand() {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("help"));
this->addTrigger("help"sv);
}
void HelpConsoleCommand::trigger(std::string_view parameters) {
@ -54,7 +53,7 @@ void HelpConsoleCommand::trigger(std::string_view parameters) {
}
std::string_view HelpConsoleCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Lists commands, or sends command-specific help. Syntax: help [command]");
static constexpr std::string_view defaultHelp = "Lists commands, or sends command-specific help. Syntax: help [command]"sv;
return defaultHelp;
}
@ -63,7 +62,7 @@ CONSOLE_COMMAND_INIT(HelpConsoleCommand)
// Help IRC Command.
void HelpIRCCommand::create() {
this->addTrigger("help"_jrs);
this->addTrigger("help"sv);
}
void HelpIRCCommand::trigger(IRC_Bot *source, std::string_view in_channel, std::string_view nick, std::string_view parameters) {
@ -75,14 +74,14 @@ void HelpIRCCommand::trigger(IRC_Bot *source, std::string_view in_channel, std::
for (int i = 0; i <= access; i++) {
auto cmds = source->getAccessCommands(channel, i);
if (cmds.size() != 0) {
Jupiter::StringL triggers = source->getTriggers(cmds);
std::string triggers = source->getTriggers(cmds);
if (triggers.size() >= 0) {
source->sendNotice(nick, string_printf("Access level %d commands: %.*s", i, triggers.size(),
triggers.data()));
}
}
}
source->sendNotice(nick, "For command-specific help, use: help <command>"_jrs);
source->sendNotice(nick, "For command-specific help, use: help <command>"sv);
}
else {
auto command_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
@ -91,19 +90,19 @@ void HelpIRCCommand::trigger(IRC_Bot *source, std::string_view in_channel, std::
int command_access = cmd->getAccessLevel(channel);
if (command_access < 0)
source->sendNotice(nick, "Error: Command disabled."_jrs);
source->sendNotice(nick, "Error: Command disabled."sv);
else if (access < command_access)
source->sendNotice(nick, "Access Denied."_jrs);
source->sendNotice(nick, "Access Denied."sv);
else
source->sendNotice(nick, cmd->getHelp(command_split.second));
}
else source->sendNotice(nick, "Error: Command not found."_jrs);
else source->sendNotice(nick, "Error: Command not found."sv);
}
}
}
std::string_view HelpIRCCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Syntax: help [command]");
static constexpr std::string_view defaultHelp = "Syntax: help [command]"sv;
return defaultHelp;
}
@ -112,12 +111,12 @@ IRC_COMMAND_INIT(HelpIRCCommand)
// Version Command
VersionGenericCommand::VersionGenericCommand() {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("version"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("versioninfo"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("copyright"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("copyrightinfo"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("client"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("clientinfo"));
this->addTrigger("version"sv);
this->addTrigger("versioninfo"sv);
this->addTrigger("copyright"sv);
this->addTrigger("copyrightinfo"sv);
this->addTrigger("client"sv);
this->addTrigger("clientinfo"sv);
}
Jupiter::GenericCommand::ResponseLine *VersionGenericCommand::trigger(std::string_view parameters) {
@ -127,7 +126,7 @@ Jupiter::GenericCommand::ResponseLine *VersionGenericCommand::trigger(std::strin
}
std::string_view VersionGenericCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays version and copyright information");
static constexpr std::string_view defaultHelp = "Displays version and copyright information"sv;
return defaultHelp;
}
@ -137,7 +136,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(VersionGenericCommand)
// Rehash Command
RehashGenericCommand::RehashGenericCommand() {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("rehash"));
this->addTrigger("rehash"sv);
}
Jupiter::GenericCommand::ResponseLine *RehashGenericCommand::trigger(std::string_view parameters) {
@ -150,7 +149,7 @@ Jupiter::GenericCommand::ResponseLine *RehashGenericCommand::trigger(std::string
}
std::string_view RehashGenericCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Rehashes configuration data from a file. Syntax: rehash [file]");
static constexpr std::string_view defaultHelp = "Rehashes configuration data from a file. Syntax: rehash [file]"sv;
return defaultHelp;
}

122
src/Plugins/ExtraCommands/ExtraCommands.cpp

@ -18,19 +18,19 @@
#include <cstring>
#include "jessilib/word_split.hpp"
#include "jessilib/unicode.hpp"
#include "Jupiter/Functions.h"
#include "ExtraCommands.h"
#include "IRC_Bot.h"
using namespace Jupiter::literals;
using namespace std::literals;
// Select Command
SelectGenericCommand::SelectGenericCommand()
{
this->addTrigger("select"_jrs);
this->addTrigger("ircselect"_jrs);
this->addTrigger("select"sv);
this->addTrigger("ircselect"sv);
}
Jupiter::GenericCommand::ResponseLine *SelectGenericCommand::trigger(std::string_view parameters)
@ -38,7 +38,7 @@ Jupiter::GenericCommand::ResponseLine *SelectGenericCommand::trigger(std::string
if (parameters.empty())
{
if (IRCCommand::selected_server == nullptr)
return new Jupiter::GenericCommand::ResponseLine("No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine(std::string{IRCCommand::selected_server->getConfigSection()} + " is currently selected."s, GenericCommand::DisplayType::PublicSuccess);
}
if (IRCCommand::active_server == IRCCommand::selected_server)
@ -46,17 +46,15 @@ Jupiter::GenericCommand::ResponseLine *SelectGenericCommand::trigger(std::string
IRCCommand::selected_server = serverManager->getServer(parameters);
if (IRCCommand::selected_server == nullptr)
return new Jupiter::GenericCommand::ResponseLine("Error: IRC server \""s + parameters + "\" not found. No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine(jessilib::join<std::string>("Error: IRC server \""sv, parameters, "\" not found. No IRC server is currently selected."sv), GenericCommand::DisplayType::PublicError);
if (IRCCommand::active_server == nullptr)
IRCCommand::active_server = IRCCommand::selected_server;
return new Jupiter::GenericCommand::ResponseLine(std::string{IRCCommand::selected_server->getConfigSection()} + " is now selected."s, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view SelectGenericCommand::getHelp(std::string_view )
{
static Jupiter::ReferenceString defaultHelp = "Selects an IRC server if specified, responds with the currently selected server otherwise. Syntax: select [server]"_jrs;
return defaultHelp;
std::string_view SelectGenericCommand::getHelp(std::string_view ) {
return "Selects an IRC server if specified, responds with the currently selected server otherwise. Syntax: select [server]"sv;
}
GENERIC_COMMAND_INIT(SelectGenericCommand)
@ -66,18 +64,18 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(SelectGenericCommand)
DeselectGenericCommand::DeselectGenericCommand()
{
this->addTrigger("deselect"_jrs);
this->addTrigger("ircdeselect"_jrs);
this->addTrigger("dselect"_jrs);
this->addTrigger("ircdselect"_jrs);
this->addTrigger("unselect"_jrs);
this->addTrigger("ircunselect"_jrs);
this->addTrigger("deselect"sv);
this->addTrigger("ircdeselect"sv);
this->addTrigger("dselect"sv);
this->addTrigger("ircdselect"sv);
this->addTrigger("unselect"sv);
this->addTrigger("ircunselect"sv);
}
Jupiter::GenericCommand::ResponseLine *DeselectGenericCommand::trigger(std::string_view parameters)
{
if (IRCCommand::selected_server == nullptr)
return new Jupiter::GenericCommand::ResponseLine("No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicSuccess);
Jupiter::GenericCommand::ResponseLine *ret = new Jupiter::GenericCommand::ResponseLine(std::string{IRCCommand::selected_server->getConfigSection()} + " has been deselected."s, GenericCommand::DisplayType::PublicSuccess);
IRCCommand::selected_server = nullptr;
@ -85,10 +83,8 @@ Jupiter::GenericCommand::ResponseLine *DeselectGenericCommand::trigger(std::stri
return ret;
}
std::string_view DeselectGenericCommand::getHelp(std::string_view )
{
static Jupiter::ReferenceString defaultHelp = "Deselects the currently selected IRC server. Syntax: deselect"_jrs;
return defaultHelp;
std::string_view DeselectGenericCommand::getHelp(std::string_view ) {
return "Deselects the currently selected IRC server. Syntax: deselect"sv;
}
GENERIC_COMMAND_INIT(DeselectGenericCommand)
@ -98,8 +94,8 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(DeselectGenericCommand)
RawGenericCommand::RawGenericCommand()
{
this->addTrigger("raw"_jrs);
this->addTrigger("sendraw"_jrs);
this->addTrigger("raw"sv);
this->addTrigger("sendraw"sv);
}
Jupiter::GenericCommand::ResponseLine *RawGenericCommand::trigger(std::string_view parameters)
@ -110,18 +106,18 @@ Jupiter::GenericCommand::ResponseLine *RawGenericCommand::trigger(std::string_vi
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
if (parameters.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: raw <message>"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: raw <message>"sv, GenericCommand::DisplayType::PrivateError);
server->send(parameters);
return new Jupiter::GenericCommand::ResponseLine("Data has been successfully sent to server."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Data has been successfully sent to server."sv, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view RawGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a line of data to the selected IRC server. Syntax: raw <message>");
static constexpr std::string_view defaultHelp = "Sends a line of data to the selected IRC server. Syntax: raw <message>"sv;
return defaultHelp;
}
@ -132,9 +128,9 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(RawGenericCommand)
IRCMessageGenericCommand::IRCMessageGenericCommand()
{
this->addTrigger("ircmsg"_jrs);
this->addTrigger("ircmessage"_jrs);
this->addTrigger("privmsg"_jrs);
this->addTrigger("ircmsg"sv);
this->addTrigger("ircmessage"sv);
this->addTrigger("privmsg"sv);
}
Jupiter::GenericCommand::ResponseLine *IRCMessageGenericCommand::trigger(std::string_view parameters)
@ -145,19 +141,19 @@ Jupiter::GenericCommand::ResponseLine *IRCMessageGenericCommand::trigger(std::st
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
auto parameters_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (parameters_split.second.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: ircmsg <destination> <message>"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: ircmsg <destination> <message>"sv, GenericCommand::DisplayType::PrivateError);
server->sendMessage(parameters_split.first, parameters_split.second);
return new Jupiter::GenericCommand::ResponseLine("Message successfully sent."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Message successfully sent."sv, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view IRCMessageGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a message to an IRC user or channel on the selected IRC server. Syntax: ircmsg <destination> <message>");
static constexpr std::string_view defaultHelp = "Sends a message to an IRC user or channel on the selected IRC server. Syntax: ircmsg <destination> <message>"sv;
return defaultHelp;
}
@ -168,7 +164,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(IRCMessageGenericCommand)
JoinGenericCommand::JoinGenericCommand()
{
this->addTrigger("Join"_jrs);
this->addTrigger("Join"sv);
}
Jupiter::GenericCommand::ResponseLine *JoinGenericCommand::trigger(std::string_view parameters)
@ -179,10 +175,10 @@ Jupiter::GenericCommand::ResponseLine *JoinGenericCommand::trigger(std::string_v
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
if (parameters.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Too Few Parameters. Syntax: join <channel> [password]"_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too Few Parameters. Syntax: join <channel> [password]"sv, GenericCommand::DisplayType::PublicError);
auto parameters_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (parameters_split.second.empty()) {
@ -192,12 +188,12 @@ Jupiter::GenericCommand::ResponseLine *JoinGenericCommand::trigger(std::string_v
server->joinChannel(parameters_split.first, parameters_split.second);
}
return new Jupiter::GenericCommand::ResponseLine("Request to join channel has been sent."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Request to join channel has been sent."sv, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view JoinGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Joins a channel. Syntax: join <channel> [password]");
static constexpr std::string_view defaultHelp = "Joins a channel. Syntax: join <channel> [password]"sv;
return defaultHelp;
}
@ -208,7 +204,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(JoinGenericCommand)
PartGenericCommand::PartGenericCommand()
{
this->addTrigger("Part"_jrs);
this->addTrigger("Part"sv);
}
Jupiter::GenericCommand::ResponseLine *PartGenericCommand::trigger(std::string_view parameters)
@ -219,10 +215,10 @@ Jupiter::GenericCommand::ResponseLine *PartGenericCommand::trigger(std::string_v
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
if (parameters.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: part <channel> [message]"_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: part <channel> [message]"sv, GenericCommand::DisplayType::PublicError);
auto parameters_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (parameters_split.second.empty()) {
@ -232,12 +228,12 @@ Jupiter::GenericCommand::ResponseLine *PartGenericCommand::trigger(std::string_v
server->partChannel(parameters_split.first, parameters_split.second);
}
return new Jupiter::GenericCommand::ResponseLine("Part command successfuly sent."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Part command successfuly sent."sv, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view PartGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Parts from a channel. Syntax: part <channel> [message]");
static constexpr std::string_view defaultHelp = "Parts from a channel. Syntax: part <channel> [message]"sv;
return defaultHelp;
}
@ -248,7 +244,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(PartGenericCommand)
DebugInfoGenericCommand::DebugInfoGenericCommand()
{
this->addTrigger("debuginfo"_jrs);
this->addTrigger("debuginfo"sv);
}
Jupiter::GenericCommand::ResponseLine *DebugInfoGenericCommand::trigger(std::string_view parameters)
@ -259,7 +255,7 @@ Jupiter::GenericCommand::ResponseLine *DebugInfoGenericCommand::trigger(std::str
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
Jupiter::GenericCommand::ResponseLine *ret = new Jupiter::GenericCommand::ResponseLine("Prefixes: "s += server->getPrefixes(), GenericCommand::DisplayType::PublicSuccess);
Jupiter::GenericCommand::ResponseLine *line = new Jupiter::GenericCommand::ResponseLine("Prefix Modes: "s += server->getPrefixModes(), GenericCommand::DisplayType::PublicSuccess);
@ -292,7 +288,7 @@ Jupiter::GenericCommand::ResponseLine *DebugInfoGenericCommand::trigger(std::str
std::string_view DebugInfoGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "DEBUG COMMAND - Spits out some information about channels. Syntax: debuginfo");
static constexpr std::string_view defaultHelp = "DEBUG COMMAND - Spits out some information about channels. Syntax: debuginfo"sv;
return defaultHelp;
}
@ -303,7 +299,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(DebugInfoGenericCommand)
ExitGenericCommand::ExitGenericCommand()
{
this->addTrigger("exit"_jrs);
this->addTrigger("exit"sv);
}
Jupiter::GenericCommand::ResponseLine *ExitGenericCommand::trigger(std::string_view parameters)
@ -313,7 +309,7 @@ Jupiter::GenericCommand::ResponseLine *ExitGenericCommand::trigger(std::string_v
std::string_view ExitGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Closes the bot's application process. Syntax: exit");
static constexpr std::string_view defaultHelp = "Closes the bot's application process. Syntax: exit"sv;
return defaultHelp;
}
@ -324,8 +320,8 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(ExitGenericCommand)
IRCConnectGenericCommand::IRCConnectGenericCommand()
{
this->addTrigger("IRCConnect"_jrs);
this->addTrigger("IRCReconnect"_jrs);
this->addTrigger("IRCConnect"sv);
this->addTrigger("IRCReconnect"sv);
}
Jupiter::GenericCommand::ResponseLine *IRCConnectGenericCommand::trigger(std::string_view parameters)
@ -338,25 +334,25 @@ Jupiter::GenericCommand::ResponseLine *IRCConnectGenericCommand::trigger(std::st
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
server->disconnect("Connect command used; reconnecting..."_jrs, false);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from IRC server."_jrs, GenericCommand::DisplayType::PublicSuccess);
server->disconnect("Connect command used; reconnecting..."sv, false);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from IRC server."sv, GenericCommand::DisplayType::PublicSuccess);
}
IRC_Bot *server = serverManager->getServer(parameters);
if (server != nullptr)
{
server->disconnect("Connect command used; reconnecting..."_jrs, false);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from IRC server."_jrs, GenericCommand::DisplayType::PublicSuccess);
server->disconnect("Connect command used; reconnecting..."sv, false);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from IRC server."sv, GenericCommand::DisplayType::PublicSuccess);
}
if (serverManager->addServer(parameters))
return new Jupiter::GenericCommand::ResponseLine("Connection successfully established; server added to server list."_jrs, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to find configuration settings for server, or connection refused."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Connection successfully established; server added to server list."sv, GenericCommand::DisplayType::PublicSuccess);
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to find configuration settings for server, or connection refused."sv, GenericCommand::DisplayType::PublicError);
}
std::string_view IRCConnectGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Connects/reconnects to an IRC server, based on config entry. Syntax: IRCConnect [server=here]");
static constexpr std::string_view defaultHelp = "Connects/reconnects to an IRC server, based on config entry. Syntax: IRCConnect [server=here]"sv;
return defaultHelp;
}
@ -367,7 +363,7 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(IRCConnectGenericCommand)
IRCDisconnectGenericCommand::IRCDisconnectGenericCommand()
{
this->addTrigger("IRCDisconnect"_jrs);
this->addTrigger("IRCDisconnect"sv);
}
Jupiter::GenericCommand::ResponseLine *IRCDisconnectGenericCommand::trigger(std::string_view parameters)
@ -378,15 +374,15 @@ Jupiter::GenericCommand::ResponseLine *IRCDisconnectGenericCommand::trigger(std:
else if (IRCCommand::active_server != nullptr)
server = IRCCommand::active_server;
else
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: No IRC server is currently selected."sv, GenericCommand::DisplayType::PublicError);
server->disconnect("Disconnect command used."_jrs, true);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from server."_jrs, GenericCommand::DisplayType::PublicSuccess);
server->disconnect("Disconnect command used."sv, true);
return new Jupiter::GenericCommand::ResponseLine("Disconnected from server."sv, GenericCommand::DisplayType::PublicSuccess);
}
std::string_view IRCDisconnectGenericCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Disconnects from an IRC server, based on config entry. Syntax: IRCDisconnect");
static constexpr std::string_view defaultHelp = "Disconnects from an IRC server, based on config entry. Syntax: IRCDisconnect"sv;
return defaultHelp;
}

107
src/Plugins/FunCommands/FunCommands.cpp

@ -24,121 +24,122 @@
#include "FunCommands.h"
#include "IRC_Bot.h"
using namespace Jupiter::literals;
using namespace std::literals;
// 8ball
void EightBallIRCCommand::create()
{
this->addTrigger("8ball"_jrs);
this->addTrigger("8balls"_jrs);
this->addTrigger("eightBall"_jrs);
this->addTrigger("8ball"sv);
this->addTrigger("8balls"sv);
this->addTrigger("eightBall"sv);
}
void EightBallIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters)
{
Jupiter::StringS msg;
std::string msg;
switch (rand() % 31)
{
case 0:
msg.set("No."_jrs);
msg = "No."sv;
break;
case 1:
msg.set("Yes."_jrs);
msg = "Yes."sv;
break;
case 2:
msg.set("Maybe."_jrs);
msg = "Maybe."sv;
break;
case 3:
msg.set("Seven."_jrs);
msg = "Seven."sv;
break;
case 4:
msg.set("Consider counseling."_jrs);
msg = "Consider counseling."sv;
break;
case 5:
msg.set("Look into a realationship. A real one."_jrs);
msg = "Look into a realationship. A real one."sv;
break;
case 6:
msg.set("Quit asking me these deep questions, before I get deeply into you."_jrs);
msg = "Quit asking me these deep questions, before I get deeply into you."sv;
break;
case 7:
msg.set("Fuck you."_jrs);
msg = "Fuck you."sv;
break;
case 8:
msg.set("Fuck me."_jrs);
msg = "Fuck me."sv;
break;
case 9:
msg.set("Good thing I bend that way!"_jrs);
msg = "Good thing I bend that way!"sv;
break;
case 10:
msg = "Hai "s + nick + "!";
msg = jessilib::join<std::string>("Hai "sv, nick, "!"sv);
break;
case 11:
msg = "Let's ban "s + nick + "!";
msg = jessilib::join<std::string>("Let's ban "sv, nick, "!"sv);
break;
case 12:
msg.set("Fuck your lineage."_jrs);
msg = "Fuck your lineage."sv;
break;
case 13:
if (channel == "#Jail"sv)
msg.set("Ask me those kind of questions in #Politics"_jrs);
else
msg.set("Ask me those kind of questions in #Jail"_jrs);
if (channel == "#Jail"sv) {
msg = "Ask me those kind of questions in #Politics"sv;
}
else {
msg = "Ask me those kind of questions in #Jail"sv;
}
break;
case 14:
msg.set("I don't talk to slut-mongers."_jrs);
msg = "I don't talk to slut-mongers."sv;
break;
case 15:
msg.set("I only talk to slut-mongers."_jrs);
msg = "I only talk to slut-mongers."sv;
break;
case 16:
msg.set("Nuclear launch detected."_jrs);
msg = "Nuclear launch detected."sv;
break;
case 17:
msg.set("404 - Not found."_jrs);
msg = "404 - Not found."sv;
break;
case 18:
msg.set("I hurr u liek mudkipz?"_jrs);
msg = "I hurr u liek mudkipz?"sv;
break;
case 19:
msg.set("Fortune might be in your favor."_jrs);
msg = "Fortune might be in your favor."sv;
break;
case 20:
msg.set("Fortune might not be in your favor."_jrs);
msg = "Fortune might not be in your favor."sv;
break;
case 21:
msg.set("Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, you're going to hell."_jrs);
msg = "Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, you're going to hell."sv;
break;
case 22:
msg.set("Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, yes!"_jrs);
msg = "Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, yes!"sv;
break;
case 23:
msg.set("Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, it's approximately as likely as getting a \"yes\" from me."_jrs);
msg = "Based on the tragectory of James Bond (9007) in relationship to the 9th circle of hell located on the 3rd planet of Sol, it's approximately as likely as getting a \"yes\" from me."sv;
break;
case 24:
msg.set("Fucking campers."_jrs);
msg = "Fucking campers."sv;
break;
case 25:
msg.set("The 8ball seems to be stuck. Try again later. (Dang, you can't even get an 8ball to work for you? That's pretty sad yo)"_jrs);
msg = "The 8ball seems to be stuck. Try again later. (Dang, you can't even get an 8ball to work for you? That's pretty sad yo)"sv;
break;
case 26:
msg.set("The 8ball says... Go away? Wow, it really must not like you. Go away."_jrs);
msg = "The 8ball says... Go away? Wow, it really must not like you. Go away."sv;
break;
case 27:
msg.set("Swag"_jrs);
msg = "Swag"sv;
break;
case 28:
msg.set("Based on the orbit and trajectory of the 33rd moon of the planet assinine 6, no."_jrs);
msg = "Based on the orbit and trajectory of the 33rd moon of the planet assinine 6, no."sv;
break;
case 29:
msg.set("Based on the orbin and trajectory of the moon assinsix 9, yes!"_jrs);
msg = "Based on the orbin and trajectory of the moon assinsix 9, yes!"sv;
break;
case 30:
msg.set("Come visit me on the 5th planet away from Sol, and I'll give you whatever you want."_jrs);
msg = "Come visit me on the 5th planet away from Sol, and I'll give you whatever you want."sv;
break;
default:
msg.set("Nothingness. You suck. Go rot."_jrs);
msg = "Nothingness. You suck. Go rot."sv;
break;
}
source->sendMessage(channel, msg);
@ -146,7 +147,7 @@ void EightBallIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std
std::string_view EightBallIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Accurately answers your question 60% of the time, EVERY time. Syntax: 8ball [question]");
static constexpr std::string_view defaultHelp = "Accurately answers your question 60% of the time, EVERY time. Syntax: 8ball [question]"sv;
return defaultHelp;
}
@ -156,43 +157,43 @@ IRC_COMMAND_INIT(EightBallIRCCommand)
ResolveGenericCommand::ResolveGenericCommand()
{
this->addTrigger("resolve"_jrs);
this->addTrigger("resolve"sv);
}
Jupiter::GenericCommand::ResponseLine *ResolveGenericCommand::trigger(std::string_view parameters) {
auto command_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (command_split.second.empty()) {
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: resolve <hostname|ip> <address>"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: resolve <hostname|ip> <address>"sv, GenericCommand::DisplayType::PrivateError);
}
std::string_view subcommand = command_split.first;
if (jessilib::equalsi(subcommand, "hostname"sv)
|| jessilib::equalsi(subcommand, "host"sv))
{
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveHostname(static_cast<std::string>(command_split.second).c_str(), 0);
std::string_view resolved = Jupiter::Socket::resolveHostname(static_cast<std::string>(command_split.second).c_str(), 0);
if (resolved.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."sv, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine(resolved, GenericCommand::DisplayType::PublicSuccess);
}
else if (jessilib::equalsi(subcommand, "ip"sv))
{
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveAddress(static_cast<std::string>(command_split.second).c_str(), 0);
std::string_view resolved = Jupiter::Socket::resolveAddress(static_cast<std::string>(command_split.second).c_str(), 0);
if (resolved.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."sv, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine(resolved, GenericCommand::DisplayType::PublicSuccess);
}
return new Jupiter::GenericCommand::ResponseLine("Error: Invalid type. You can only resolve hostnames and IP addresses."_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Invalid type. You can only resolve hostnames and IP addresses."sv, GenericCommand::DisplayType::PrivateError);
}
std::string_view ResolveGenericCommand::getHelp(std::string_view parameters)
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Resolves an IP address or hostname. Syntax: resolve <hostname|ip> <address>");
static STRING_LITERAL_AS_NAMED_REFERENCE(hostHelp, "Resolves a hostname to an IP address. Syntax: resolve hostname <address>");
static STRING_LITERAL_AS_NAMED_REFERENCE(ipHelp, "Reverse-resolves an IP address to a hostname. Syntax: resolve ip <address>");
static constexpr std::string_view defaultHelp = "Resolves an IP address or hostname. Syntax: resolve <hostname|ip> <address>"sv;
static constexpr std::string_view hostHelp = "Resolves a hostname to an IP address. Syntax: resolve hostname <address>"sv;
static constexpr std::string_view ipHelp = "Reverse-resolves an IP address to a hostname. Syntax: resolve ip <address>"sv;
if (jessilib::equalsi(parameters, "hostname"_jrs) || jessilib::equalsi(parameters, "host"_jrs))
if (jessilib::equalsi(parameters, "hostname"sv) || jessilib::equalsi(parameters, "host"sv))
return hostHelp;
if (jessilib::equalsi(parameters, "ip"_jrs))
if (jessilib::equalsi(parameters, "ip"sv))
return ipHelp;
return defaultHelp;

15
src/Plugins/HTTPServer/HTTPServer.cpp

@ -18,32 +18,27 @@
#include "HTTPServer.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool HTTPServerPlugin::initialize() {
return HTTPServerPlugin::server.bind(this->config.get("BindAddress"_jrs, "0.0.0.0"sv), this->config.get<uint16_t>("BindPort"_jrs, 80));
return HTTPServerPlugin::server.bind(this->config.get("BindAddress"sv, "0.0.0.0"sv), this->config.get<uint16_t>("BindPort"sv, 80));
}
int HTTPServerPlugin::think()
{
int HTTPServerPlugin::think() {
return HTTPServerPlugin::server.think();
}
// Plugin instantiation and entry point.
HTTPServerPlugin pluginInstance;
HTTPServerPlugin &getHTTPServerPlugin()
{
HTTPServerPlugin &getHTTPServerPlugin() {
return pluginInstance;
}
Jupiter::HTTP::Server &getHTTPServer()
{
Jupiter::HTTP::Server &getHTTPServer() {
return pluginInstance.server;
}
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

2
src/Plugins/HTTPServer/HTTPServer.h

@ -25,8 +25,6 @@
*/
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/String.hpp"
#include "Jupiter/HTTP_Server.h"
#include "Jupiter_Bot.h"

5
src/Plugins/IRC.Core/IRC_Core.cpp

@ -18,11 +18,12 @@
#include "jessilib/word_split.hpp"
#include "Jupiter/GenericCommand.h"
#include "Jupiter/Functions.h"
#include "ServerManager.h"
#include "IRC_Command.h"
#include "IRC_Core.h"
using namespace Jupiter::literals;
using namespace std::literals;
IRCCorePlugin::~IRCCorePlugin() {
// Destroy all IRC connections on plugin unload
@ -33,7 +34,7 @@ IRCCorePlugin::~IRCCorePlugin() {
bool IRCCorePlugin::initialize() {
// TODO: initialize() isn't bringing in generic commands from already-loaded plugins
std::string_view serverList = this->config.get("Servers"_jrs);
std::string_view serverList = this->config.get("Servers"sv);
if (!serverList.empty()) {
serverManager->setConfig(this->config);

1
src/Plugins/IRC.Core/IRC_Core.h

@ -20,7 +20,6 @@
#define _IRC_CORE_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
class IRCCorePlugin : public Jupiter::Plugin
{

9
src/Plugins/Plugin.Example/Example.cpp

@ -9,28 +9,27 @@
#include "Example.h"
#include "IRC_Bot.h"
using namespace Jupiter::literals;
void ExamplePlugin::OnConnect(Jupiter::IRC::Client *server)
{
server->sendNotice("Agent"_jrs, "Honey, I'm home!"_jrs);
server->sendNotice("Agent"sv, "Honey, I'm home!"sv);
}
// Example IRC Command Implementation
void ExampleIRCCommand::create()
{
this->addTrigger("example"_jrs);
this->addTrigger("example"sv);
}
void ExampleIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters)
{
source->sendMessage(channel, "This is an example command!"_jrs);
source->sendMessage(channel, "This is an example command!"sv);
}
std::string_view ExampleIRCCommand::getHelp(std::string_view )
{
static auto helpmsg = "This is just an example command. It takes no parameters!"_jrs;
static auto helpmsg = "This is just an example command. It takes no parameters!"sv;
return helpmsg;
}

1
src/Plugins/Plugin.Template/Example.h

@ -10,7 +10,6 @@
#define _EXAMPLE_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
class TPlugin : public Jupiter::Plugin
{

45
src/Plugins/PluginManager/PluginManager.cpp

@ -23,15 +23,14 @@
#include "jessilib/unicode.hpp"
#include "PluginManager.h"
using namespace Jupiter::literals;
using namespace std::literals;
// Plugin Generic Command
PluginGenericCommand::PluginGenericCommand() {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("plugin"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("plugins"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("module"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("modules"));
this->addTrigger("plugin"sv);
this->addTrigger("plugins"sv);
this->addTrigger("module"sv);
this->addTrigger("modules"sv);
}
Jupiter::GenericCommand::ResponseLine *PluginGenericCommand::trigger(std::string_view parameters) {
@ -61,23 +60,23 @@ Jupiter::GenericCommand::ResponseLine *PluginGenericCommand::trigger(std::string
auto split_params = jessilib::word_split_once_view(parameters_view, WHITESPACE_SV);
if (jessilib::starts_withi(parameters_view, "load "sv)) {
if (Jupiter::Plugin::load(split_params.second) == nullptr) {
return result->set("Error: Failed to load plugin."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Failed to load plugin."sv, GenericCommand::DisplayType::PublicError);
}
return result->set("Plugin successfully loaded."_jrs, GenericCommand::DisplayType::PublicSuccess);
return result->set("Plugin successfully loaded."sv, GenericCommand::DisplayType::PublicSuccess);
}
if (jessilib::starts_withi(parameters_view, "unload "sv)) {
auto plugin = find_plugin(split_params.second);
if (plugin == nullptr) {
return result->set("Error: Plugin does not exist."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Plugin does not exist."sv, GenericCommand::DisplayType::PublicError);
}
if (!Jupiter::Plugin::free(plugin)) {
return result->set("Error: Failed to unload plugin."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Failed to unload plugin."sv, GenericCommand::DisplayType::PublicError);
}
return result->set("Plugin successfully unloaded."_jrs, GenericCommand::DisplayType::PublicSuccess);
return result->set("Plugin successfully unloaded."sv, GenericCommand::DisplayType::PublicSuccess);
}
if (jessilib::starts_withi(parameters_view, "reload"sv)) {
@ -88,45 +87,45 @@ Jupiter::GenericCommand::ResponseLine *PluginGenericCommand::trigger(std::string
Jupiter::reinitialize_plugins();
}, true);
return result->set("Triggering full plugin reload..."_jrs, GenericCommand::DisplayType::PublicSuccess);
return result->set("Triggering full plugin reload..."sv, GenericCommand::DisplayType::PublicSuccess);
}
else {
// A specific plugin
auto plugin = find_plugin(split_params.second);
if (plugin == nullptr) {
return result->set("Error: Plugin does not exist."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Plugin does not exist."sv, GenericCommand::DisplayType::PublicError);
}
std::string_view plugin_name = plugin->getName();
if (!Jupiter::Plugin::free(plugin)) {
return result->set("Error: Failed to unload plugin."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Failed to unload plugin."sv, GenericCommand::DisplayType::PublicError);
}
if (Jupiter::Plugin::load(plugin_name) == nullptr) {
return result->set("Error: Failed to load plugin."_jrs, GenericCommand::DisplayType::PublicError);
return result->set("Error: Failed to load plugin."sv, GenericCommand::DisplayType::PublicError);
}
return result->set("Plugin successfully reloaded."_jrs, GenericCommand::DisplayType::PublicSuccess);
return result->set("Plugin successfully reloaded."sv, GenericCommand::DisplayType::PublicSuccess);
}
}
return result->set("Error: Invalid Syntax. Syntax: plugin {[list], <load> <plugin>, <unload> <plugin>, <reload> [all|plugin]}"_jrs, GenericCommand::DisplayType::PrivateError);
return result->set("Error: Invalid Syntax. Syntax: plugin {[list], <load> <plugin>, <unload> <plugin>, <reload> [all|plugin]}"sv, GenericCommand::DisplayType::PrivateError);
}
std::string_view PluginGenericCommand::getHelp(std::string_view parameters) {
static STRING_LITERAL_AS_NAMED_REFERENCE(loadHelp, "Loads a plugin by file name. Do not include a file extension. Syntax: plugin load <plugin>");
static STRING_LITERAL_AS_NAMED_REFERENCE(unloadHelp, "Unloads a plugin by name. Syntax: plugin unload <plugin>");
static STRING_LITERAL_AS_NAMED_REFERENCE(listHelp, "Lists all of the plugins currently loaded. Syntax: plugin [list]");
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Manages plugins. Syntax: plugin {[list], <load> <plugin>, <unload> <plugin>, <reload> [plugin]}");
static constexpr std::string_view loadHelp = "Loads a plugin by file name. Do not include a file extension. Syntax: plugin load <plugin>"sv;
static constexpr std::string_view unloadHelp = "Unloads a plugin by name. Syntax: plugin unload <plugin>"sv;
static constexpr std::string_view listHelp = "Lists all of the plugins currently loaded. Syntax: plugin [list]"sv;
static constexpr std::string_view defaultHelp = "Manages plugins. Syntax: plugin {[list], <load> <plugin>, <unload> <plugin>, <reload> [plugin]}"sv;
if (jessilib::equalsi(parameters, STRING_LITERAL_AS_REFERENCE("load"))) {
if (jessilib::equalsi(parameters, "load"sv)) {
return loadHelp;
}
if (jessilib::equalsi(parameters, STRING_LITERAL_AS_REFERENCE("unload"))) {
if (jessilib::equalsi(parameters, "unload"sv)) {
return unloadHelp;
}
if (jessilib::equalsi(parameters, STRING_LITERAL_AS_REFERENCE("list"))) {
if (jessilib::equalsi(parameters, "list"sv)) {
return listHelp;
}

7
src/Plugins/RenX/RenX.AlwaysRecord/RenX_AlwaysRecord.cpp

@ -19,11 +19,10 @@
#include "RenX_Server.h"
#include "RenX_AlwaysRecord.h"
using namespace Jupiter::literals;
using namespace std::literals;
void RenX_AlwaysRecord::RenX_OnMapStart(RenX::Server &server, std::string_view )
{
server.send("demorec"_jrs);
void RenX_AlwaysRecord::RenX_OnMapStart(RenX::Server &server, std::string_view ) {
server.send("demorec"sv);
}
// Plugin instantiation and entry point.

1
src/Plugins/RenX/RenX.AlwaysRecord/RenX_AlwaysRecord.h

@ -20,7 +20,6 @@
#define _RENX_ALWAYSRECORD_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_AlwaysRecord : public RenX::Plugin

3
src/Plugins/RenX/RenX.Announcements/RenX_Announcements.cpp

@ -22,7 +22,6 @@
#include "RenX_Server.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX_AnnouncementsPlugin pluginInstance;
@ -83,7 +82,7 @@ bool RenX_AnnouncementsPlugin::initialize()
fputs("[RenX.Announcements] ERROR: No announcements loaded." ENDL, stderr);
return false;
}
std::chrono::milliseconds delay = std::chrono::seconds(this->config.get<long long>("Delay"_jrs, 60));
std::chrono::milliseconds delay = std::chrono::seconds(this->config.get<long long>("Delay"sv, 60));
RenX_AnnouncementsPlugin::timer = new Jupiter::Timer(0, delay, announce_);
if (RenX_AnnouncementsPlugin::random == false)
RenX_AnnouncementsPlugin::lastLine = RenX_AnnouncementsPlugin::announcementsFile.getLineCount() - 1;

2
src/Plugins/RenX/RenX.Announcements/RenX_Announcements.h

@ -22,8 +22,6 @@
#include "Jupiter/Plugin.h"
#include "Jupiter/Timer.h"
#include "Jupiter/File.h"
#include "Jupiter/String.hpp"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_AnnouncementsPlugin : public RenX::Plugin

1
src/Plugins/RenX/RenX.ChatLogging/RenX_ChatLogging.h

@ -10,7 +10,6 @@
#define _RENX_CHATLOG_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_ChatLogPlugin : public RenX::Plugin

29
src/Plugins/RenX/RenX.CommandLogging/RenX_CommandLogging.cpp

@ -9,16 +9,16 @@
#include <iostream>
#include <fstream>
#include <string>
#include "jessilib/unicode.hpp"
#include "RenX_CommandLogging.h"
#include "RenX_GameCommand.h"
#include "RenX_PlayerInfo.h"
#include "RenX_Server.h"
#include "RenX_Functions.h"
using namespace Jupiter::literals;
using namespace std::literals;
void RenX_CommandLoggingPlugin::PrepFile()
{
void RenX_CommandLoggingPlugin::PrepFile() {
// Check if date changed (Format: YYYY-MM-DD)
std::string current_date = getTimeFormat("%F");
std::string full_date = getTimeFormat("%c");
@ -44,39 +44,30 @@ void RenX_CommandLoggingPlugin::PrepFile()
<< std::endl;
}
bool RenX_CommandLoggingPlugin::initialize()
{
RenX_CommandLoggingPlugin::min_access = this->config.get<int>("MinPlayerLevelToLog"_jrs, 1);
RenX_CommandLoggingPlugin::min_cmd_access = this->config.get<int>("MinCommandLevelToLog"_jrs, 1);
bool RenX_CommandLoggingPlugin::initialize() {
RenX_CommandLoggingPlugin::min_access = this->config.get<int>("MinPlayerLevelToLog"sv, 1);
RenX_CommandLoggingPlugin::min_cmd_access = this->config.get<int>("MinCommandLevelToLog"sv, 1);
PrepFile();
return fs.is_open();
}
RenX_CommandLoggingPlugin::~RenX_CommandLoggingPlugin()
{
RenX_CommandLoggingPlugin::~RenX_CommandLoggingPlugin() {
if (fs.is_open()) {
fs.close();
}
}
void RenX_CommandLoggingPlugin::RenX_OnCommandTriggered(RenX::Server& server, std::string_view trigger, RenX::PlayerInfo& player, std::string_view parameters, RenX::GameCommand& command)
{
void RenX_CommandLoggingPlugin::RenX_OnCommandTriggered(RenX::Server& server, std::string_view trigger, RenX::PlayerInfo& player, std::string_view parameters, RenX::GameCommand& command) {
if (player.access < min_access || command.getAccessLevel() < min_cmd_access) {
return;
}
WriteToLog(server, player, static_cast<std::string>(trigger) + " " + parameters);
WriteToLog(server, player, jessilib::join<std::string>(trigger, " "sv, parameters));
}
std::ostream& operator<<(std::ostream& in_stream, std::string_view in_string) {
in_stream.write(in_string.data(), in_string.size());
return in_stream;
}
void RenX_CommandLoggingPlugin::WriteToLog(RenX::Server& server, const RenX::PlayerInfo& player, std::string_view message)
{
void RenX_CommandLoggingPlugin::WriteToLog(RenX::Server& server, const RenX::PlayerInfo& player, std::string_view message) {
// Check if new file needs to be opened
PrepFile();

1
src/Plugins/RenX/RenX.CommandLogging/RenX_CommandLogging.h

@ -10,7 +10,6 @@
#define _RENX_CMDLOGGING_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_CommandLoggingPlugin : public RenX::Plugin

1105
src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp

File diff suppressed because it is too large

23
src/Plugins/RenX/RenX.Core/RenX_BanDatabase.cpp

@ -19,12 +19,13 @@
#include <ctime>
#include <cstdio>
#include "Jupiter/IRC_Client.h"
#include "Jupiter/DataBuffer.h"
#include "RenX_PlayerInfo.h"
#include "RenX_BanDatabase.h"
#include "RenX_Core.h"
#include "RenX_Plugin.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX::BanDatabase _banDatabase;
RenX::BanDatabase *RenX::banDatabase = &_banDatabase;
@ -54,15 +55,15 @@ void RenX::BanDatabase::process_data(Jupiter::DataBuffer &buffer, FILE *file, fp
entry->ip = buffer.pop<uint32_t>();
entry->prefix_length = buffer.pop<uint8_t>();
if (m_read_version >= 5U)
entry->hwid = buffer.pop<Jupiter::String_Strict, char>();
entry->rdns = buffer.pop<Jupiter::String_Strict, char>();
entry->name = buffer.pop<Jupiter::String_Strict, char>();
entry->banner = buffer.pop<Jupiter::String_Strict, char>();
entry->reason = buffer.pop<Jupiter::String_Strict, char>();
entry->hwid = buffer.pop<std::string>();
entry->rdns = buffer.pop<std::string>();
entry->name = buffer.pop<std::string>();
entry->banner = buffer.pop<std::string>();
entry->reason = buffer.pop<std::string>();
// Read varData from buffer to entry
for (size_t varData_entries = buffer.pop<size_t>(); varData_entries != 0; --varData_entries) {
entry->varData[buffer.pop<Jupiter::String_Strict, char>()] = buffer.pop<Jupiter::String_Strict, char>();
entry->varData[buffer.pop<std::string>()] = buffer.pop<std::string>();
}
m_entries.push_back(std::move(entry));
@ -177,10 +178,12 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo &player
entry->reason = reason;
// add plugin data
Jupiter::String pluginData;
std::string pluginData;
for (Plugin* plugin : RenX::getCore()->getPlugins()) {
if (plugin->RenX_OnBan(*server, player, pluginData)) {
entry->varData[plugin->getName()] = pluginData;
if (!pluginData.empty()) {
entry->varData[plugin->getName()] = pluginData;
}
}
}
@ -240,7 +243,7 @@ const std::vector<std::unique_ptr<RenX::BanDatabase::Entry>>& RenX::BanDatabase:
}
bool RenX::BanDatabase::initialize() {
m_filename = static_cast<std::string>(RenX::getCore()->getConfig().get("BanDB"_jrs, "Bans.db"_jrs));
m_filename = RenX::getCore()->getConfig().get("BanDB"sv, "Bans.db"s);
return this->process_file(m_filename);
}

3
src/Plugins/RenX/RenX.Core/RenX_BanDatabase.h

@ -22,7 +22,6 @@
#include <cstdint>
#include <unordered_map>
#include "Jupiter/Database.h"
#include "Jupiter/String.hpp"
#include "RenX.h"
/** DLL Linkage Nagging */
@ -78,7 +77,7 @@ namespace RenX
*/
struct RENX_API Entry
{
using VarDataTableType = std::unordered_map<Jupiter::StringS, Jupiter::StringS, Jupiter::default_hash_function>;
using VarDataTableType = std::unordered_map<std::string, std::string, Jupiter::default_hash_function, std::equal_to<>>;
fpos_t pos; /** Position of the entry in the database */
uint16_t flags /** Flags affecting this ban entry (See below for flags) */ = 0x00;

1
src/Plugins/RenX/RenX.Core/RenX_BuildingInfo.h

@ -24,7 +24,6 @@
* @brief Defines the BuildingInfo structure.
*/
#include "Jupiter/String.hpp"
#include "Jupiter/Config.h"
#include "RenX.h"

10
src/Plugins/RenX/RenX.Core/RenX_Core.cpp

@ -30,7 +30,7 @@
#include "RenX_ExemptionDatabase.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX::Core pluginInstance;
RenX::Core *RenXInstance = &pluginInstance;
@ -45,8 +45,8 @@ bool RenX::Core::initialize() {
RenX::tags->initialize();
RenX::initTranslations(this->config);
std::string_view serverList = this->config.get("Servers"_jrs);
m_commandsFile.read(this->config.get("CommandsFile"_jrs, "RenXGameCommands.ini"_jrs));
std::string_view serverList = this->config.get("Servers"sv);
m_commandsFile.read(this->config.get("CommandsFile"sv, "RenXGameCommands.ini"sv));
auto server_entries = jessilib::word_split_view(serverList, WHITESPACE_SV);
for (const auto& entry : server_entries) {
@ -89,7 +89,7 @@ size_t RenX::Core::getServerIndex(RenX::Server *server) {
}
}
return Jupiter::INVALID_INDEX;
return SIZE_MAX;
}
RenX::Server* RenX::Core::getServer(size_t index) {
@ -137,7 +137,7 @@ size_t RenX::Core::removeServer(RenX::Server *server) {
}
}
return Jupiter::INVALID_INDEX;
return SIZE_MAX;
}
bool RenX::Core::hasServer(RenX::Server* in_server) {

7
src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.cpp

@ -18,12 +18,13 @@
#include <cstdio>
#include "Jupiter/IRC_Client.h"
#include "Jupiter/DataBuffer.h"
#include "RenX_PlayerInfo.h"
#include "RenX_ExemptionDatabase.h"
#include "RenX_Core.h"
#include "RenX_Plugin.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX::ExemptionDatabase g_exemptionDatabase;
RenX::ExemptionDatabase *RenX::exemptionDatabase = &g_exemptionDatabase;
@ -40,7 +41,7 @@ void RenX::ExemptionDatabase::process_data(Jupiter::DataBuffer &buffer, FILE *fi
entry->steamid = buffer.pop<uint64_t>();
entry->ip = buffer.pop<uint32_t>();
entry->prefix_length = buffer.pop<uint8_t>();
entry->setter = buffer.pop<Jupiter::String_Strict, char>();
entry->setter = buffer.pop<std::string>();
m_entries.push_back(std::move(entry));
}
@ -167,7 +168,7 @@ const std::vector<std::unique_ptr<RenX::ExemptionDatabase::Entry>>& RenX::Exempt
}
bool RenX::ExemptionDatabase::initialize() {
m_filename = static_cast<std::string>(RenX::getCore()->getConfig().get("ExemptionDB"_jrs, "Exemptions.db"_jrs));
m_filename = RenX::getCore()->getConfig().get("ExemptionDB"sv, "Exemptions.db"s);
return this->process_file(m_filename);
}

1
src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.h

@ -22,7 +22,6 @@
#include <cstdint>
#include <chrono>
#include "Jupiter/Database.h"
#include "Jupiter/String.hpp"
#include "RenX.h"
/** DLL Linkage Nagging */

625
src/Plugins/RenX/RenX.Core/RenX_Functions.cpp

@ -26,23 +26,22 @@
#include "RenX_Server.h"
#include "RenX_PlayerInfo.h"
using namespace Jupiter::literals;
using namespace std::literals;
/** Team color translations */
Jupiter::ReferenceString NodColor = "04";
Jupiter::ReferenceString GDIColor = "08";
Jupiter::ReferenceString OtherColor = "14";
static std::string_view NodColor = "04";
static std::string_view GDIColor = "08";
static std::string_view OtherColor = "14";
/** Short team name translations */
Jupiter::ReferenceString NodShortName = "Nod";
Jupiter::ReferenceString GDIShortName = "GDI";
Jupiter::ReferenceString OtherShortName = "N/A";
static std::string_view NodShortName = "Nod";
static std::string_view GDIShortName = "GDI";
static std::string_view OtherShortName = "N/A";
/** Long team name translations */
Jupiter::ReferenceString NodLongName = "Brotherhood of Nod";
Jupiter::ReferenceString GDILongName = "Global Defense Initiative";
Jupiter::ReferenceString OtherLongName = "Unknown";
static std::string_view NodLongName = "Brotherhood of Nod";
static std::string_view GDILongName = "Global Defense Initiative";
static std::string_view OtherLongName = "Unknown";
/** RenegadeX RCON protocol message deliminator */
const char RenX::DelimC = '\x02';
@ -51,304 +50,304 @@ const std::string_view RenX::DevBotName = "DevBot"sv;
/** WinType translations */
Jupiter::ReferenceString scoreWinTypeTranslation = "Domination (High Score)";
Jupiter::ReferenceString baseWinTypeTranslation = "Conquest (Base Destruction)";
Jupiter::ReferenceString beaconWinTypeTranslation = "Espionage (Beacon)";
Jupiter::ReferenceString tieWinTypeTranslation = "Draw (Tie)";
Jupiter::ReferenceString shutdownWinTypeTranslation = "Ceasefire (Shutdown)";
Jupiter::ReferenceString surrenderWinTypeTranslation = "Forfeit (Surrender)";
Jupiter::ReferenceString unknownWinTypeTranslation = "Aliens (Unknown)";
static std::string_view scoreWinTypeTranslation = "Domination (High Score)";
static std::string_view baseWinTypeTranslation = "Conquest (Base Destruction)";
static std::string_view beaconWinTypeTranslation = "Espionage (Beacon)";
static std::string_view tieWinTypeTranslation = "Draw (Tie)";
static std::string_view shutdownWinTypeTranslation = "Ceasefire (Shutdown)";
static std::string_view surrenderWinTypeTranslation = "Forfeit (Surrender)";
static std::string_view unknownWinTypeTranslation = "Aliens (Unknown)";
/** WinType plain translations */
Jupiter::ReferenceString scoreWinTypePlainTranslation = "High Score";
Jupiter::ReferenceString baseWinTypePlainTranslation = "Base Destruction";
Jupiter::ReferenceString beaconWinTypePlainTranslation = "Beacon";
Jupiter::ReferenceString tieWinTypePlainTranslation = "Tie";
Jupiter::ReferenceString shutdownWinTypePlainTranslation = "Shutdown";
Jupiter::ReferenceString surrenderWinTypePlainTranslation = "Surrender";
Jupiter::ReferenceString unknownWinTypePlainTranslation = "Unknown";
static std::string_view scoreWinTypePlainTranslation = "High Score";
static std::string_view baseWinTypePlainTranslation = "Base Destruction";
static std::string_view beaconWinTypePlainTranslation = "Beacon";
static std::string_view tieWinTypePlainTranslation = "Tie";
static std::string_view shutdownWinTypePlainTranslation = "Shutdown";
static std::string_view surrenderWinTypePlainTranslation = "Surrender";
static std::string_view unknownWinTypePlainTranslation = "Unknown";
/** Vote translations */
Jupiter::ReferenceString translated_VoteMenuChoice_AddBots = STRING_LITERAL_AS_REFERENCE("Add Bots");
Jupiter::ReferenceString translated_VoteMenuChoice_ChangeMap = STRING_LITERAL_AS_REFERENCE("Change Map");
Jupiter::ReferenceString translated_VoteMenuChoice_Donate = STRING_LITERAL_AS_REFERENCE("Donate");
Jupiter::ReferenceString translated_VoteMenuChoice_Kick = STRING_LITERAL_AS_REFERENCE("Kick");
Jupiter::ReferenceString translated_VoteMenuChoice_RemoveBots = STRING_LITERAL_AS_REFERENCE("Remove Bots");
Jupiter::ReferenceString translated_VoteMenuChoice_RestartMatch = STRING_LITERAL_AS_REFERENCE("Restart Match");
Jupiter::ReferenceString translated_VoteMenuChoice_StartMatch = STRING_LITERAL_AS_REFERENCE("Start Match");
Jupiter::ReferenceString translated_VoteMenuChoice_Survey = STRING_LITERAL_AS_REFERENCE("Survey");
static constexpr std::string_view translated_VoteMenuChoice_AddBots = "Add Bots"sv;
static constexpr std::string_view translated_VoteMenuChoice_ChangeMap = "Change Map"sv;
static constexpr std::string_view translated_VoteMenuChoice_Donate = "Donate"sv;
static constexpr std::string_view translated_VoteMenuChoice_Kick = "Kick"sv;
static constexpr std::string_view translated_VoteMenuChoice_RemoveBots = "Remove Bots"sv;
static constexpr std::string_view translated_VoteMenuChoice_RestartMatch = "Restart Match"sv;
static constexpr std::string_view translated_VoteMenuChoice_StartMatch = "Start Match"sv;
static constexpr std::string_view translated_VoteMenuChoice_Survey = "Survey"sv;
/** Object / damage type translations */
/** Nod Vehicles */
Jupiter::ReferenceString translated_Vehicle_Harvester_Nod = STRING_LITERAL_AS_REFERENCE("Nod Harvester");
Jupiter::ReferenceString translated_Vehicle_Buggy = STRING_LITERAL_AS_REFERENCE("Buggy");
Jupiter::ReferenceString translated_Vehicle_Artillery = STRING_LITERAL_AS_REFERENCE("Mobile Artillery");
Jupiter::ReferenceString translated_Vehicle_APC_Nod = STRING_LITERAL_AS_REFERENCE("Nod APC");
Jupiter::ReferenceString translated_Vehicle_LightTank = STRING_LITERAL_AS_REFERENCE("Light Tank");
Jupiter::ReferenceString translated_Vehicle_FlameTank = STRING_LITERAL_AS_REFERENCE("Flame Tank");
Jupiter::ReferenceString translated_Vehicle_StealthTank = STRING_LITERAL_AS_REFERENCE("Stealth Tank");
Jupiter::ReferenceString translated_Vehicle_Chinook_Nod = STRING_LITERAL_AS_REFERENCE("Nod Chinook");
Jupiter::ReferenceString translated_Vehicle_Apache = STRING_LITERAL_AS_REFERENCE("Apache");
Jupiter::ReferenceString translated_Vehicle_ReconBike = STRING_LITERAL_AS_REFERENCE("Recon Bike");
Jupiter::ReferenceString translated_Vehicle_TickTank = STRING_LITERAL_AS_REFERENCE("Tick Tank");
static constexpr std::string_view translated_Vehicle_Harvester_Nod = "Nod Harvester"sv;
static constexpr std::string_view translated_Vehicle_Buggy = "Buggy"sv;
static constexpr std::string_view translated_Vehicle_Artillery = "Mobile Artillery"sv;
static constexpr std::string_view translated_Vehicle_APC_Nod = "Nod APC"sv;
static constexpr std::string_view translated_Vehicle_LightTank = "Light Tank"sv;
static constexpr std::string_view translated_Vehicle_FlameTank = "Flame Tank"sv;
static constexpr std::string_view translated_Vehicle_StealthTank = "Stealth Tank"sv;
static constexpr std::string_view translated_Vehicle_Chinook_Nod = "Nod Chinook"sv;
static constexpr std::string_view translated_Vehicle_Apache = "Apache"sv;
static constexpr std::string_view translated_Vehicle_ReconBike = "Recon Bike"sv;
static constexpr std::string_view translated_Vehicle_TickTank = "Tick Tank"sv;
/** GDI Vehicles */
Jupiter::ReferenceString translated_Vehicle_Harvester_GDI = STRING_LITERAL_AS_REFERENCE("GDI Harvester");
Jupiter::ReferenceString translated_Vehicle_Humvee = STRING_LITERAL_AS_REFERENCE("Humvee");
Jupiter::ReferenceString translated_Vehicle_MRLS = STRING_LITERAL_AS_REFERENCE("Mobile Rocket Launcher System");
Jupiter::ReferenceString translated_Vehicle_APC_GDI = STRING_LITERAL_AS_REFERENCE("GDI APC");
Jupiter::ReferenceString translated_Vehicle_MediumTank = STRING_LITERAL_AS_REFERENCE("Medium Tank");
Jupiter::ReferenceString translated_Vehicle_MammothTank = STRING_LITERAL_AS_REFERENCE("Mammoth Tank");
Jupiter::ReferenceString translated_Vehicle_Chinook_GDI = STRING_LITERAL_AS_REFERENCE("GDI Chinook");
Jupiter::ReferenceString translated_Vehicle_Orca = STRING_LITERAL_AS_REFERENCE("Orca");
Jupiter::ReferenceString translated_Vehicle_HoverMRLS = STRING_LITERAL_AS_REFERENCE("Hover MRLS");
Jupiter::ReferenceString translated_Vehicle_Titan = STRING_LITERAL_AS_REFERENCE("Titan");
Jupiter::ReferenceString translated_Vehicle_Wolverine = STRING_LITERAL_AS_REFERENCE("Wolverine");
static constexpr std::string_view translated_Vehicle_Harvester_GDI = "GDI Harvester"sv;
static constexpr std::string_view translated_Vehicle_Humvee = "Humvee"sv;
static constexpr std::string_view translated_Vehicle_MRLS = "Mobile Rocket Launcher System"sv;
static constexpr std::string_view translated_Vehicle_APC_GDI = "GDI APC"sv;
static constexpr std::string_view translated_Vehicle_MediumTank = "Medium Tank"sv;
static constexpr std::string_view translated_Vehicle_MammothTank = "Mammoth Tank"sv;
static constexpr std::string_view translated_Vehicle_Chinook_GDI = "GDI Chinook"sv;
static constexpr std::string_view translated_Vehicle_Orca = "Orca"sv;
static constexpr std::string_view translated_Vehicle_HoverMRLS = "Hover MRLS"sv;
static constexpr std::string_view translated_Vehicle_Titan = "Titan"sv;
static constexpr std::string_view translated_Vehicle_Wolverine = "Wolverine"sv;
/** Other Vehicles */
Jupiter::ReferenceString translated_Vehicle_A10_DmgType_GattlingGun = STRING_LITERAL_AS_REFERENCE("A10 Thunderbolt Gattling Gun");
Jupiter::ReferenceString translated_Vehicle_A10_DmgType_Bomb = STRING_LITERAL_AS_REFERENCE("A10 Thunderbolt Bomb");
Jupiter::ReferenceString translated_Vehicle_AC130_DmgType_HeavyCannon = STRING_LITERAL_AS_REFERENCE("AC130 Heavy Cannon");
Jupiter::ReferenceString translated_Vehicle_AC130_DmgType_AutoCannon = STRING_LITERAL_AS_REFERENCE("AC130 Auto Cannon");
static constexpr std::string_view translated_Vehicle_A10_DmgType_GattlingGun = "A10 Thunderbolt Gattling Gun"sv;
static constexpr std::string_view translated_Vehicle_A10_DmgType_Bomb = "A10 Thunderbolt Bomb"sv;
static constexpr std::string_view translated_Vehicle_AC130_DmgType_HeavyCannon = "AC130 Heavy Cannon"sv;
static constexpr std::string_view translated_Vehicle_AC130_DmgType_AutoCannon = "AC130 Auto Cannon"sv;
/** Weapons */
Jupiter::ReferenceString translated_Weapon_HeavyPistol = STRING_LITERAL_AS_REFERENCE("Heavy Pistol");
Jupiter::ReferenceString translated_Weapon_Carbine = STRING_LITERAL_AS_REFERENCE("Carbine");
Jupiter::ReferenceString translated_Weapon_Airstrike_GDI = STRING_LITERAL_AS_REFERENCE("GDI Airstrike");
Jupiter::ReferenceString translated_Weapon_Airstrike_Nod = STRING_LITERAL_AS_REFERENCE("Nod Airstrike");
Jupiter::ReferenceString translated_Weapon_TiberiumFlechetteRifle = STRING_LITERAL_AS_REFERENCE("Tiberium Flechette Gun");
Jupiter::ReferenceString translated_Weapon_TiberiumAutoRifle = STRING_LITERAL_AS_REFERENCE("Tiberium Automatic Rifle");
Jupiter::ReferenceString translated_Weapon_TiberiumAutoRifle_Blue = STRING_LITERAL_AS_REFERENCE("Blue Tiberium Automatic Rifle Burst");
Jupiter::ReferenceString translated_Weapon_EMPGrenade = STRING_LITERAL_AS_REFERENCE("EMP Grenade");
Jupiter::ReferenceString translated_Weapon_SmokeGrenade = STRING_LITERAL_AS_REFERENCE("Smoke Grenade");
Jupiter::ReferenceString translated_Weapon_TimedC4 = STRING_LITERAL_AS_REFERENCE("Timed C4");
Jupiter::ReferenceString translated_Weapon_RemoteC4 = STRING_LITERAL_AS_REFERENCE("Remote C4");
Jupiter::ReferenceString translated_Weapon_ProxyC4 = STRING_LITERAL_AS_REFERENCE("Proximity C4");
Jupiter::ReferenceString translated_Weapon_ATMine = STRING_LITERAL_AS_REFERENCE("Anti-Tank Mine");
Jupiter::ReferenceString translated_Weapon_IonCannonBeacon = STRING_LITERAL_AS_REFERENCE("Ion Cannon Beacon");
Jupiter::ReferenceString translated_Weapon_NukeBeacon = STRING_LITERAL_AS_REFERENCE("Nuclear Missile Beacon");
Jupiter::ReferenceString translated_Weapon_DeployedC4 = STRING_LITERAL_AS_REFERENCE("Timed C4");
Jupiter::ReferenceString translated_Weapon_DeployedTimedC4 = STRING_LITERAL_AS_REFERENCE("Timed C4");
Jupiter::ReferenceString translated_Weapon_DeployedRemoteC4 = STRING_LITERAL_AS_REFERENCE("Remote C4");
Jupiter::ReferenceString translated_Weapon_DeployedProxyC4 = STRING_LITERAL_AS_REFERENCE("Proximity C4");
Jupiter::ReferenceString translated_Weapon_DeployedATMine = STRING_LITERAL_AS_REFERENCE("Anti-Tank Mine");
Jupiter::ReferenceString translated_Weapon_DeployedIonCannonBeacon = STRING_LITERAL_AS_REFERENCE("Ion Cannon Beacon");
Jupiter::ReferenceString translated_Weapon_DeployedNukeBeacon = STRING_LITERAL_AS_REFERENCE("Nuclear Missile Beacon");
Jupiter::ReferenceString translated_Weapon_CrateNuke = STRING_LITERAL_AS_REFERENCE("Nuclear Crate Explosion");
Jupiter::ReferenceString translated_Weapon_DevNuke = STRING_LITERAL_AS_REFERENCE("Nuclear Dev Explosion");
static constexpr std::string_view translated_Weapon_HeavyPistol = "Heavy Pistol"sv;
static constexpr std::string_view translated_Weapon_Carbine = "Carbine"sv;
static constexpr std::string_view translated_Weapon_Airstrike_GDI = "GDI Airstrike"sv;
static constexpr std::string_view translated_Weapon_Airstrike_Nod = "Nod Airstrike"sv;
static constexpr std::string_view translated_Weapon_TiberiumFlechetteRifle = "Tiberium Flechette Gun"sv;
static constexpr std::string_view translated_Weapon_TiberiumAutoRifle = "Tiberium Automatic Rifle"sv;
static constexpr std::string_view translated_Weapon_TiberiumAutoRifle_Blue = "Blue Tiberium Automatic Rifle Burst"sv;
static constexpr std::string_view translated_Weapon_EMPGrenade = "EMP Grenade"sv;
static constexpr std::string_view translated_Weapon_SmokeGrenade = "Smoke Grenade"sv;
static constexpr std::string_view translated_Weapon_TimedC4 = "Timed C4"sv;
static constexpr std::string_view translated_Weapon_RemoteC4 = "Remote C4"sv;
static constexpr std::string_view translated_Weapon_ProxyC4 = "Proximity C4"sv;
static constexpr std::string_view translated_Weapon_ATMine = "Anti-Tank Mine"sv;
static constexpr std::string_view translated_Weapon_IonCannonBeacon = "Ion Cannon Beacon"sv;
static constexpr std::string_view translated_Weapon_NukeBeacon = "Nuclear Missile Beacon"sv;
static constexpr std::string_view translated_Weapon_DeployedC4 = "Timed C4"sv;
static constexpr std::string_view translated_Weapon_DeployedTimedC4 = "Timed C4"sv;
static constexpr std::string_view translated_Weapon_DeployedRemoteC4 = "Remote C4"sv;
static constexpr std::string_view translated_Weapon_DeployedProxyC4 = "Proximity C4"sv;
static constexpr std::string_view translated_Weapon_DeployedATMine = "Anti-Tank Mine"sv;
static constexpr std::string_view translated_Weapon_DeployedIonCannonBeacon = "Ion Cannon Beacon"sv;
static constexpr std::string_view translated_Weapon_DeployedNukeBeacon = "Nuclear Missile Beacon"sv;
static constexpr std::string_view translated_Weapon_CrateNuke = "Nuclear Crate Explosion"sv;
static constexpr std::string_view translated_Weapon_DevNuke = "Nuclear Dev Explosion"sv;
/** Projectiles */
Jupiter::ReferenceString translated_Projectile_EMPGrenade = STRING_LITERAL_AS_REFERENCE("EMP Grenade");
Jupiter::ReferenceString translated_Projectile_SmokeGrenade = STRING_LITERAL_AS_REFERENCE("Smoke Grenade");
static constexpr std::string_view translated_Projectile_EMPGrenade = "EMP Grenade"sv;
static constexpr std::string_view translated_Projectile_SmokeGrenade = "Smoke Grenade"sv;
/** GDI Characters */
Jupiter::ReferenceString translated_GDI_Deadeye = STRING_LITERAL_AS_REFERENCE("Deadeye");
Jupiter::ReferenceString translated_GDI_Engineer = STRING_LITERAL_AS_REFERENCE("GDI Engineer");
Jupiter::ReferenceString translated_GDI_Grenadier = STRING_LITERAL_AS_REFERENCE("Grenadier");
Jupiter::ReferenceString translated_GDI_Gunner = STRING_LITERAL_AS_REFERENCE("Gunner");
Jupiter::ReferenceString translated_GDI_Havoc = STRING_LITERAL_AS_REFERENCE("Havoc");
Jupiter::ReferenceString translated_GDI_Hotwire = STRING_LITERAL_AS_REFERENCE("Hotwire");
Jupiter::ReferenceString translated_GDI_Marksman = STRING_LITERAL_AS_REFERENCE("GDI Marksman");
Jupiter::ReferenceString translated_GDI_McFarland = STRING_LITERAL_AS_REFERENCE("McFarland");
Jupiter::ReferenceString translated_GDI_Mobius = STRING_LITERAL_AS_REFERENCE("Mobius");
Jupiter::ReferenceString translated_GDI_Officer = STRING_LITERAL_AS_REFERENCE("GDI Officer");
Jupiter::ReferenceString translated_GDI_Patch = STRING_LITERAL_AS_REFERENCE("Patch");
Jupiter::ReferenceString translated_GDI_RocketSoldier = STRING_LITERAL_AS_REFERENCE("GDI Rocket Soldier");
Jupiter::ReferenceString translated_GDI_Shotgunner = STRING_LITERAL_AS_REFERENCE("GDI Shotgunner");
Jupiter::ReferenceString translated_GDI_Soldier = STRING_LITERAL_AS_REFERENCE("GDI Soldier");
Jupiter::ReferenceString translated_GDI_Sydney = STRING_LITERAL_AS_REFERENCE("Sydney");
static constexpr std::string_view translated_GDI_Deadeye = "Deadeye"sv;
static constexpr std::string_view translated_GDI_Engineer = "GDI Engineer"sv;
static constexpr std::string_view translated_GDI_Grenadier = "Grenadier"sv;
static constexpr std::string_view translated_GDI_Gunner = "Gunner"sv;
static constexpr std::string_view translated_GDI_Havoc = "Havoc"sv;
static constexpr std::string_view translated_GDI_Hotwire = "Hotwire"sv;
static constexpr std::string_view translated_GDI_Marksman = "GDI Marksman"sv;
static constexpr std::string_view translated_GDI_McFarland = "McFarland"sv;
static constexpr std::string_view translated_GDI_Mobius = "Mobius"sv;
static constexpr std::string_view translated_GDI_Officer = "GDI Officer"sv;
static constexpr std::string_view translated_GDI_Patch = "Patch"sv;
static constexpr std::string_view translated_GDI_RocketSoldier = "GDI Rocket Soldier"sv;
static constexpr std::string_view translated_GDI_Shotgunner = "GDI Shotgunner"sv;
static constexpr std::string_view translated_GDI_Soldier = "GDI Soldier"sv;
static constexpr std::string_view translated_GDI_Sydney = "Sydney"sv;
/** Nod Characters */
Jupiter::ReferenceString translated_Nod_BlackHandSniper = STRING_LITERAL_AS_REFERENCE("Black Hand Sniper");
Jupiter::ReferenceString translated_Nod_ChemicalTrooper = STRING_LITERAL_AS_REFERENCE("Chemical Trooper");
Jupiter::ReferenceString translated_Nod_Engineer = STRING_LITERAL_AS_REFERENCE("Nod Engineer");
Jupiter::ReferenceString translated_Nod_FlameTrooper = STRING_LITERAL_AS_REFERENCE("Flame Trooper");
Jupiter::ReferenceString translated_Nod_LaserChainGunner = STRING_LITERAL_AS_REFERENCE("Laser Chain Gunner");
Jupiter::ReferenceString translated_Nod_Marksman = STRING_LITERAL_AS_REFERENCE("Nod Marksman");
Jupiter::ReferenceString translated_Nod_Mendoza = STRING_LITERAL_AS_REFERENCE("Mendoza");
Jupiter::ReferenceString translated_Nod_Officer = STRING_LITERAL_AS_REFERENCE("Nod Officer");
Jupiter::ReferenceString translated_Nod_Raveshaw = STRING_LITERAL_AS_REFERENCE("Raveshaw");
Jupiter::ReferenceString translated_Nod_RocketSoldier = STRING_LITERAL_AS_REFERENCE("Nod Rocket Soldier");
Jupiter::ReferenceString translated_Nod_Sakura = STRING_LITERAL_AS_REFERENCE("Sakura");
Jupiter::ReferenceString translated_Nod_Shotgunner = STRING_LITERAL_AS_REFERENCE("Nod Shotgunner");
Jupiter::ReferenceString translated_Nod_Soldier = STRING_LITERAL_AS_REFERENCE("Nod Soldier");
Jupiter::ReferenceString translated_Nod_StealthBlackHand = STRING_LITERAL_AS_REFERENCE("Stealth Black Hand");
Jupiter::ReferenceString translated_Nod_Technician = STRING_LITERAL_AS_REFERENCE("Technician");
static constexpr std::string_view translated_Nod_BlackHandSniper = "Black Hand Sniper"sv;
static constexpr std::string_view translated_Nod_ChemicalTrooper = "Chemical Trooper"sv;
static constexpr std::string_view translated_Nod_Engineer = "Nod Engineer"sv;
static constexpr std::string_view translated_Nod_FlameTrooper = "Flame Trooper"sv;
static constexpr std::string_view translated_Nod_LaserChainGunner = "Laser Chain Gunner"sv;
static constexpr std::string_view translated_Nod_Marksman = "Nod Marksman"sv;
static constexpr std::string_view translated_Nod_Mendoza = "Mendoza"sv;
static constexpr std::string_view translated_Nod_Officer = "Nod Officer"sv;
static constexpr std::string_view translated_Nod_Raveshaw = "Raveshaw"sv;
static constexpr std::string_view translated_Nod_RocketSoldier = "Nod Rocket Soldier"sv;
static constexpr std::string_view translated_Nod_Sakura = "Sakura"sv;
static constexpr std::string_view translated_Nod_Shotgunner = "Nod Shotgunner"sv;
static constexpr std::string_view translated_Nod_Soldier = "Nod Soldier"sv;
static constexpr std::string_view translated_Nod_StealthBlackHand = "Stealth Black Hand"sv;
static constexpr std::string_view translated_Nod_Technician = "Technician"sv;
/** Non-weapon damage types */
Jupiter::ReferenceString translated_DmgType_Suicided = STRING_LITERAL_AS_REFERENCE("Suicide");
Jupiter::ReferenceString translated_DmgType_Fell = STRING_LITERAL_AS_REFERENCE("Fall");
Jupiter::ReferenceString translated_DmgType_Tiberium = STRING_LITERAL_AS_REFERENCE("Tiberium");
Jupiter::ReferenceString translated_DmgType_TiberiumBleed = STRING_LITERAL_AS_REFERENCE("Tiberium Decay");
Jupiter::ReferenceString translated_DmgType_TiberiumBleed_Blue = STRING_LITERAL_AS_REFERENCE("Blue Tiberium Decay");
Jupiter::ReferenceString translated_DmgType_RanOver = STRING_LITERAL_AS_REFERENCE("Crushed");
static constexpr std::string_view translated_DmgType_Suicided = "Suicide"sv;
static constexpr std::string_view translated_DmgType_Fell = "Fall"sv;
static constexpr std::string_view translated_DmgType_Tiberium = "Tiberium"sv;
static constexpr std::string_view translated_DmgType_TiberiumBleed = "Tiberium Decay"sv;
static constexpr std::string_view translated_DmgType_TiberiumBleed_Blue = "Blue Tiberium Decay"sv;
static constexpr std::string_view translated_DmgType_RanOver = "Crushed"sv;
/** Infantry weapons */
Jupiter::ReferenceString translated_DmgType_Pistol = STRING_LITERAL_AS_REFERENCE("Pistol");
Jupiter::ReferenceString translated_DmgType_SMG = STRING_LITERAL_AS_REFERENCE("Machine Pistol");
Jupiter::ReferenceString translated_DmgType_HeavyPistol = STRING_LITERAL_AS_REFERENCE("Heavy Pistol");
Jupiter::ReferenceString translated_DmgType_Carbine = STRING_LITERAL_AS_REFERENCE("Carbine");
Jupiter::ReferenceString translated_DmgType_TiberiumFlechetteRifle = STRING_LITERAL_AS_REFERENCE("Tiberium Flechette Gun"); // Not a rifle.
Jupiter::ReferenceString translated_DmgType_TiberiumAutoRifle = STRING_LITERAL_AS_REFERENCE("Tiberium Automatic Rifle");
Jupiter::ReferenceString translated_DmgType_TiberiumAutoRifle_Blue = STRING_LITERAL_AS_REFERENCE("Blue Tiberium Automatic Rifle Burst");
Jupiter::ReferenceString translated_DmgType_TiberiumAutoRifle_Flechette_Blue = STRING_LITERAL_AS_REFERENCE("Blue Tiberium Automatic Rifle");
Jupiter::ReferenceString translated_DmgType_Grenade = STRING_LITERAL_AS_REFERENCE("Grenade");
Jupiter::ReferenceString translated_DmgType_TimedC4 = STRING_LITERAL_AS_REFERENCE("Timed C4");
Jupiter::ReferenceString translated_DmgType_RemoteC4 = STRING_LITERAL_AS_REFERENCE("Remote C4");
Jupiter::ReferenceString translated_DmgType_ProxyC4 = STRING_LITERAL_AS_REFERENCE("Proximity C4");
Jupiter::ReferenceString translated_DmgType_ATMine = STRING_LITERAL_AS_REFERENCE("Anti-Tank Mine");
Jupiter::ReferenceString translated_DmgType_EMPGrenade = STRING_LITERAL_AS_REFERENCE("EMP Grenade");
Jupiter::ReferenceString translated_DmgType_BurnC4 = STRING_LITERAL_AS_REFERENCE("C4 Burn");
Jupiter::ReferenceString translated_DmgType_FireBleed = STRING_LITERAL_AS_REFERENCE("Fire Burn"); // Caused by C4 or flame weapons
Jupiter::ReferenceString translated_DmgType_AutoRifle = STRING_LITERAL_AS_REFERENCE("Automatic Rifle");
Jupiter::ReferenceString translated_DmgType_Shotgun = STRING_LITERAL_AS_REFERENCE("Shotgun");
Jupiter::ReferenceString translated_DmgType_FlameThrower = STRING_LITERAL_AS_REFERENCE("Flamethrower");
Jupiter::ReferenceString translated_DmgType_GrenadeLauncher = STRING_LITERAL_AS_REFERENCE("Grenade Launcher");
Jupiter::ReferenceString translated_DmgType_MarksmanRifle = STRING_LITERAL_AS_REFERENCE("Marksman's Rifle");
Jupiter::ReferenceString translated_DmgType_ChainGun = STRING_LITERAL_AS_REFERENCE("Chain Gun");
Jupiter::ReferenceString translated_DmgType_MissileLauncher = STRING_LITERAL_AS_REFERENCE("Missile Launcher");
Jupiter::ReferenceString translated_DmgType_MissileLauncher_Alt = STRING_LITERAL_AS_REFERENCE("Missile Launcher");
Jupiter::ReferenceString translated_DmgType_ChemicalThrower = STRING_LITERAL_AS_REFERENCE("Chemical Spray Gun");
Jupiter::ReferenceString translated_DmgType_LaserRifle = STRING_LITERAL_AS_REFERENCE("Laser Rifle");
Jupiter::ReferenceString translated_DmgType_TacticalRifle = STRING_LITERAL_AS_REFERENCE("Tactical Rifle");
Jupiter::ReferenceString translated_DmgType_RocketLauncher = STRING_LITERAL_AS_REFERENCE("Rocket Launcher");
Jupiter::ReferenceString translated_DmgType_LaserChainGun = STRING_LITERAL_AS_REFERENCE("Laser Chain Gun");
Jupiter::ReferenceString translated_DmgType_FlakCannon = STRING_LITERAL_AS_REFERENCE("Flak");
Jupiter::ReferenceString translated_DmgType_FlakCannon_Alt = STRING_LITERAL_AS_REFERENCE("Concentrated Flak");
Jupiter::ReferenceString translated_DmgType_SniperRifle = STRING_LITERAL_AS_REFERENCE("Sniper Rifle");
Jupiter::ReferenceString translated_DmgType_RamjetRifle = STRING_LITERAL_AS_REFERENCE("Ramjet");
Jupiter::ReferenceString translated_DmgType_Railgun = STRING_LITERAL_AS_REFERENCE("Railgun");
Jupiter::ReferenceString translated_DmgType_PersonalIonCannon = STRING_LITERAL_AS_REFERENCE("Personal Ion Cannon");
Jupiter::ReferenceString translated_DmgType_VoltRifle = STRING_LITERAL_AS_REFERENCE("Volt Rifle");
Jupiter::ReferenceString translated_DmgType_VoltRifle_Alt = STRING_LITERAL_AS_REFERENCE("Volt Rifle Burst");
Jupiter::ReferenceString translated_DmgType_VoltAutoRifle = STRING_LITERAL_AS_REFERENCE("Volt Automatic Rifle");
Jupiter::ReferenceString translated_DmgType_VoltAutoRifle_Alt = STRING_LITERAL_AS_REFERENCE("Volt Automatic Rifle Burst");
static constexpr std::string_view translated_DmgType_Pistol = "Pistol"sv;
static constexpr std::string_view translated_DmgType_SMG = "Machine Pistol"sv;
static constexpr std::string_view translated_DmgType_HeavyPistol = "Heavy Pistol"sv;
static constexpr std::string_view translated_DmgType_Carbine = "Carbine"sv;
static constexpr std::string_view translated_DmgType_TiberiumFlechetteRifle = "Tiberium Flechette Gun"sv; // Not a rifle.
static constexpr std::string_view translated_DmgType_TiberiumAutoRifle = "Tiberium Automatic Rifle"sv;
static constexpr std::string_view translated_DmgType_TiberiumAutoRifle_Blue = "Blue Tiberium Automatic Rifle Burst"sv;
static constexpr std::string_view translated_DmgType_TiberiumAutoRifle_Flechette_Blue = "Blue Tiberium Automatic Rifle"sv;
static constexpr std::string_view translated_DmgType_Grenade = "Grenade"sv;
static constexpr std::string_view translated_DmgType_TimedC4 = "Timed C4"sv;
static constexpr std::string_view translated_DmgType_RemoteC4 = "Remote C4"sv;
static constexpr std::string_view translated_DmgType_ProxyC4 = "Proximity C4"sv;
static constexpr std::string_view translated_DmgType_ATMine = "Anti-Tank Mine"sv;
static constexpr std::string_view translated_DmgType_EMPGrenade = "EMP Grenade"sv;
static constexpr std::string_view translated_DmgType_BurnC4 = "C4 Burn"sv;
static constexpr std::string_view translated_DmgType_FireBleed = "Fire Burn"sv; // Caused by C4 or flame weapons
static constexpr std::string_view translated_DmgType_AutoRifle = "Automatic Rifle"sv;
static constexpr std::string_view translated_DmgType_Shotgun = "Shotgun"sv;
static constexpr std::string_view translated_DmgType_FlameThrower = "Flamethrower"sv;
static constexpr std::string_view translated_DmgType_GrenadeLauncher = "Grenade Launcher"sv;
static constexpr std::string_view translated_DmgType_MarksmanRifle = "Marksman's Rifle"sv;
static constexpr std::string_view translated_DmgType_ChainGun = "Chain Gun"sv;
static constexpr std::string_view translated_DmgType_MissileLauncher = "Missile Launcher"sv;
static constexpr std::string_view translated_DmgType_MissileLauncher_Alt = "Missile Launcher"sv;
static constexpr std::string_view translated_DmgType_ChemicalThrower = "Chemical Spray Gun"sv;
static constexpr std::string_view translated_DmgType_LaserRifle = "Laser Rifle"sv;
static constexpr std::string_view translated_DmgType_TacticalRifle = "Tactical Rifle"sv;
static constexpr std::string_view translated_DmgType_RocketLauncher = "Rocket Launcher"sv;
static constexpr std::string_view translated_DmgType_LaserChainGun = "Laser Chain Gun"sv;
static constexpr std::string_view translated_DmgType_FlakCannon = "Flak"sv;
static constexpr std::string_view translated_DmgType_FlakCannon_Alt = "Concentrated Flak"sv;
static constexpr std::string_view translated_DmgType_SniperRifle = "Sniper Rifle"sv;
static constexpr std::string_view translated_DmgType_RamjetRifle = "Ramjet"sv;
static constexpr std::string_view translated_DmgType_Railgun = "Railgun"sv;
static constexpr std::string_view translated_DmgType_PersonalIonCannon = "Personal Ion Cannon"sv;
static constexpr std::string_view translated_DmgType_VoltRifle = "Volt Rifle"sv;
static constexpr std::string_view translated_DmgType_VoltRifle_Alt = "Volt Rifle Burst"sv;
static constexpr std::string_view translated_DmgType_VoltAutoRifle = "Volt Automatic Rifle"sv;
static constexpr std::string_view translated_DmgType_VoltAutoRifle_Alt = "Volt Automatic Rifle Burst"sv;
/** Vehicle weapons */
Jupiter::ReferenceString translated_DmgType_MammothTank_Missile = STRING_LITERAL_AS_REFERENCE("Mammoth Tank Missile");
Jupiter::ReferenceString translated_DmgType_MammothTank_Cannon = STRING_LITERAL_AS_REFERENCE("Mammoth Tank Cannon");
Jupiter::ReferenceString translated_DmgType_Orca_Missile = STRING_LITERAL_AS_REFERENCE("Orca Missile");
Jupiter::ReferenceString translated_DmgType_Orca_Gun = STRING_LITERAL_AS_REFERENCE("Orca Gun");
Jupiter::ReferenceString translated_DmgType_Orca_Passenger = STRING_LITERAL_AS_REFERENCE("Orca Passenger Missile");
Jupiter::ReferenceString translated_DmgType_Apache_Rocket = STRING_LITERAL_AS_REFERENCE("Apache Rocket");
Jupiter::ReferenceString translated_DmgType_Apache_Gun = STRING_LITERAL_AS_REFERENCE("Apache Gun");
Jupiter::ReferenceString translated_DmgType_Apache_Passenger = STRING_LITERAL_AS_REFERENCE("Apache Passenger Missile");
static constexpr std::string_view translated_DmgType_MammothTank_Missile = "Mammoth Tank Missile"sv;
static constexpr std::string_view translated_DmgType_MammothTank_Cannon = "Mammoth Tank Cannon"sv;
static constexpr std::string_view translated_DmgType_Orca_Missile = "Orca Missile"sv;
static constexpr std::string_view translated_DmgType_Orca_Gun = "Orca Gun"sv;
static constexpr std::string_view translated_DmgType_Orca_Passenger = "Orca Passenger Missile"sv;
static constexpr std::string_view translated_DmgType_Apache_Rocket = "Apache Rocket"sv;
static constexpr std::string_view translated_DmgType_Apache_Gun = "Apache Gun"sv;
static constexpr std::string_view translated_DmgType_Apache_Passenger = "Apache Passenger Missile"sv;
/** Other weapons */
Jupiter::ReferenceString translated_DmgType_AGT_MG = STRING_LITERAL_AS_REFERENCE("Machine Gun");
Jupiter::ReferenceString translated_DmgType_AGT_Rocket = STRING_LITERAL_AS_REFERENCE("Rocket");
Jupiter::ReferenceString translated_DmgType_Obelisk = STRING_LITERAL_AS_REFERENCE("Obelisk Laser");
Jupiter::ReferenceString translated_DmgType_GuardTower = STRING_LITERAL_AS_REFERENCE("Guard Tower");
Jupiter::ReferenceString translated_DmgType_Turret = STRING_LITERAL_AS_REFERENCE("Turret");
Jupiter::ReferenceString translated_DmgType_SAMSite = STRING_LITERAL_AS_REFERENCE("SAM Site");
Jupiter::ReferenceString translated_DmgType_AATower = STRING_LITERAL_AS_REFERENCE("Anti-Air Guard Tower");
Jupiter::ReferenceString translated_DmgType_GunEmpl = STRING_LITERAL_AS_REFERENCE("Gun Emplacement Gattling Gun");
Jupiter::ReferenceString translated_DmgType_GunEmpl_Alt = STRING_LITERAL_AS_REFERENCE("Gun Emplacement Automatic Cannon");
Jupiter::ReferenceString translated_DmgType_RocketEmpl_Swarm = STRING_LITERAL_AS_REFERENCE("Rocket Emplacement Swarm Missile");
Jupiter::ReferenceString translated_DmgType_RocketEmpl_Missile = STRING_LITERAL_AS_REFERENCE("Rocket Emplacement Hellfire Missile");
Jupiter::ReferenceString translated_DmgType_Nuke = STRING_LITERAL_AS_REFERENCE("Nuclear Missile Strike");
Jupiter::ReferenceString translated_DmgType_IonCannon = STRING_LITERAL_AS_REFERENCE("Ion Cannon Strike");
static constexpr std::string_view translated_DmgType_AGT_MG = "Machine Gun"sv;
static constexpr std::string_view translated_DmgType_AGT_Rocket = "Rocket"sv;
static constexpr std::string_view translated_DmgType_Obelisk = "Obelisk Laser"sv;
static constexpr std::string_view translated_DmgType_GuardTower = "Guard Tower"sv;
static constexpr std::string_view translated_DmgType_Turret = "Turret"sv;
static constexpr std::string_view translated_DmgType_SAMSite = "SAM Site"sv;
static constexpr std::string_view translated_DmgType_AATower = "Anti-Air Guard Tower"sv;
static constexpr std::string_view translated_DmgType_GunEmpl = "Gun Emplacement Gattling Gun"sv;
static constexpr std::string_view translated_DmgType_GunEmpl_Alt = "Gun Emplacement Automatic Cannon"sv;
static constexpr std::string_view translated_DmgType_RocketEmpl_Swarm = "Rocket Emplacement Swarm Missile"sv;
static constexpr std::string_view translated_DmgType_RocketEmpl_Missile = "Rocket Emplacement Hellfire Missile"sv;
static constexpr std::string_view translated_DmgType_Nuke = "Nuclear Missile Strike"sv;
static constexpr std::string_view translated_DmgType_IonCannon = "Ion Cannon Strike"sv;
/** Nod Vehicles */
Jupiter::ReferenceString translated_DmgType_Harvester_Nod = STRING_LITERAL_AS_REFERENCE("Nod Harvester");
Jupiter::ReferenceString translated_DmgType_Buggy = STRING_LITERAL_AS_REFERENCE("Buggy");
Jupiter::ReferenceString translated_DmgType_Artillery = STRING_LITERAL_AS_REFERENCE("Mobile Artillery");
Jupiter::ReferenceString translated_DmgType_APC_Nod = STRING_LITERAL_AS_REFERENCE("Nod APC");
Jupiter::ReferenceString translated_DmgType_LightTank = STRING_LITERAL_AS_REFERENCE("Light Tank");
Jupiter::ReferenceString translated_DmgType_FlameTank = STRING_LITERAL_AS_REFERENCE("Flame Tank");
Jupiter::ReferenceString translated_DmgType_StealthTank = STRING_LITERAL_AS_REFERENCE("Stealth Tank");
Jupiter::ReferenceString translated_DmgType_Chinook_Nod = STRING_LITERAL_AS_REFERENCE("Nod Chinook");
Jupiter::ReferenceString translated_DmgType_Apache = STRING_LITERAL_AS_REFERENCE("Apache");
Jupiter::ReferenceString translated_Vehicle_ReconBike_DmgType = STRING_LITERAL_AS_REFERENCE("Recon Bike");
Jupiter::ReferenceString translated_Vehicle_TickTank_DmgType = STRING_LITERAL_AS_REFERENCE("Tick Tank");
static constexpr std::string_view translated_DmgType_Harvester_Nod = "Nod Harvester"sv;
static constexpr std::string_view translated_DmgType_Buggy = "Buggy"sv;
static constexpr std::string_view translated_DmgType_Artillery = "Mobile Artillery"sv;
static constexpr std::string_view translated_DmgType_APC_Nod = "Nod APC"sv;
static constexpr std::string_view translated_DmgType_LightTank = "Light Tank"sv;
static constexpr std::string_view translated_DmgType_FlameTank = "Flame Tank"sv;
static constexpr std::string_view translated_DmgType_StealthTank = "Stealth Tank"sv;
static constexpr std::string_view translated_DmgType_Chinook_Nod = "Nod Chinook"sv;
static constexpr std::string_view translated_DmgType_Apache = "Apache"sv;
static constexpr std::string_view translated_Vehicle_ReconBike_DmgType = "Recon Bike"sv;
static constexpr std::string_view translated_Vehicle_TickTank_DmgType = "Tick Tank"sv;
/** GDI Vehicles */
Jupiter::ReferenceString translated_DmgType_Harvester_GDI = STRING_LITERAL_AS_REFERENCE("GDI Harvester");
Jupiter::ReferenceString translated_DmgType_Humvee = STRING_LITERAL_AS_REFERENCE("Humvee");
Jupiter::ReferenceString translated_DmgType_MRLS = STRING_LITERAL_AS_REFERENCE("Mobile Rocket Launcher System");
Jupiter::ReferenceString translated_DmgType_APC_GDI = STRING_LITERAL_AS_REFERENCE("GDI APC");
Jupiter::ReferenceString translated_DmgType_MediumTank = STRING_LITERAL_AS_REFERENCE("Medium Tank");
Jupiter::ReferenceString translated_DmgType_MammothTank = STRING_LITERAL_AS_REFERENCE("Mammoth Tank");
Jupiter::ReferenceString translated_DmgType_Chinook_GDI = STRING_LITERAL_AS_REFERENCE("GDI Chinook");
Jupiter::ReferenceString translated_DmgType_Orca = STRING_LITERAL_AS_REFERENCE("Orca");
Jupiter::ReferenceString translated_Vehicle_HoverMRLS_DmgType = STRING_LITERAL_AS_REFERENCE("Hover MRLS");
Jupiter::ReferenceString translated_Vehicle_Titan_DmgType = STRING_LITERAL_AS_REFERENCE("Titan");
Jupiter::ReferenceString translated_Vehicle_Wolverine_DmgType = STRING_LITERAL_AS_REFERENCE("Wolverine");
static constexpr std::string_view translated_DmgType_Harvester_GDI = "GDI Harvester"sv;
static constexpr std::string_view translated_DmgType_Humvee = "Humvee"sv;
static constexpr std::string_view translated_DmgType_MRLS = "Mobile Rocket Launcher System"sv;
static constexpr std::string_view translated_DmgType_APC_GDI = "GDI APC"sv;
static constexpr std::string_view translated_DmgType_MediumTank = "Medium Tank"sv;
static constexpr std::string_view translated_DmgType_MammothTank = "Mammoth Tank"sv;
static constexpr std::string_view translated_DmgType_Chinook_GDI = "GDI Chinook"sv;
static constexpr std::string_view translated_DmgType_Orca = "Orca"sv;
static constexpr std::string_view translated_Vehicle_HoverMRLS_DmgType = "Hover MRLS"sv;
static constexpr std::string_view translated_Vehicle_Titan_DmgType = "Titan"sv;
static constexpr std::string_view translated_Vehicle_Wolverine_DmgType = "Wolverine"sv;
/** Other Vehicles */
Jupiter::ReferenceString translated_DmgType_A10_Missile = STRING_LITERAL_AS_REFERENCE("A10 Missile");
static constexpr std::string_view translated_DmgType_A10_Missile = "A10 Missile"sv;
/** Nod structures */
Jupiter::ReferenceString translated_Building_HandOfNod = STRING_LITERAL_AS_REFERENCE("Hand of Nod");
Jupiter::ReferenceString translated_Building_AirTower = STRING_LITERAL_AS_REFERENCE("Airstrip");
Jupiter::ReferenceString translated_Building_Airstrip = STRING_LITERAL_AS_REFERENCE("Airstrip");
Jupiter::ReferenceString translated_Building_Refinery_Nod = STRING_LITERAL_AS_REFERENCE("Nod Refinery");
Jupiter::ReferenceString translated_Building_PowerPlant_Nod = STRING_LITERAL_AS_REFERENCE("Nod Power Plant");
Jupiter::ReferenceString translated_Building_HandOfNod_Internals = STRING_LITERAL_AS_REFERENCE("Hand of Nod");
Jupiter::ReferenceString translated_Building_AirTower_Internals = STRING_LITERAL_AS_REFERENCE("Airstrip");
Jupiter::ReferenceString translated_Building_Airstrip_Internals = STRING_LITERAL_AS_REFERENCE("Airstrip");
Jupiter::ReferenceString translated_Building_Refinery_Nod_Internals = STRING_LITERAL_AS_REFERENCE("Nod Refinery");
Jupiter::ReferenceString translated_Building_PowerPlant_Nod_Internals = STRING_LITERAL_AS_REFERENCE("Nod Power Plant");
static constexpr std::string_view translated_Building_HandOfNod = "Hand of Nod"sv;
static constexpr std::string_view translated_Building_AirTower = "Airstrip"sv;
static constexpr std::string_view translated_Building_Airstrip = "Airstrip"sv;
static constexpr std::string_view translated_Building_Refinery_Nod = "Nod Refinery"sv;
static constexpr std::string_view translated_Building_PowerPlant_Nod = "Nod Power Plant"sv;
static constexpr std::string_view translated_Building_HandOfNod_Internals = "Hand of Nod"sv;
static constexpr std::string_view translated_Building_AirTower_Internals = "Airstrip"sv;
static constexpr std::string_view translated_Building_Airstrip_Internals = "Airstrip"sv;
static constexpr std::string_view translated_Building_Refinery_Nod_Internals = "Nod Refinery"sv;
static constexpr std::string_view translated_Building_PowerPlant_Nod_Internals = "Nod Power Plant"sv;
/** GDI structures */
Jupiter::ReferenceString translated_Building_Barracks = STRING_LITERAL_AS_REFERENCE("Barracks");
Jupiter::ReferenceString translated_Building_WeaponsFactory = STRING_LITERAL_AS_REFERENCE("Weapons Factory");
Jupiter::ReferenceString translated_Building_Refinery_GDI = STRING_LITERAL_AS_REFERENCE("GDI Refinery");
Jupiter::ReferenceString translated_Building_PowerPlant_GDI = STRING_LITERAL_AS_REFERENCE("GDI Power Plant");
Jupiter::ReferenceString translated_Building_Barracks_Internals = STRING_LITERAL_AS_REFERENCE("Barracks");
Jupiter::ReferenceString translated_Building_WeaponsFactory_Internals = STRING_LITERAL_AS_REFERENCE("Weapons Factory");
Jupiter::ReferenceString translated_Building_Refinery_GDI_Internals = STRING_LITERAL_AS_REFERENCE("GDI Refinery");
Jupiter::ReferenceString translated_Building_PowerPlant_GDI_Internals = STRING_LITERAL_AS_REFERENCE("GDI Power Plant");
static constexpr std::string_view translated_Building_Barracks = "Barracks"sv;
static constexpr std::string_view translated_Building_WeaponsFactory = "Weapons Factory"sv;
static constexpr std::string_view translated_Building_Refinery_GDI = "GDI Refinery"sv;
static constexpr std::string_view translated_Building_PowerPlant_GDI = "GDI Power Plant"sv;
static constexpr std::string_view translated_Building_Barracks_Internals = "Barracks"sv;
static constexpr std::string_view translated_Building_WeaponsFactory_Internals = "Weapons Factory"sv;
static constexpr std::string_view translated_Building_Refinery_GDI_Internals = "GDI Refinery"sv;
static constexpr std::string_view translated_Building_PowerPlant_GDI_Internals = "GDI Power Plant"sv;
/** Defense structures */
Jupiter::ReferenceString translated_Building_AdvancedGuardTower = STRING_LITERAL_AS_REFERENCE("Advanced Guard Tower");
Jupiter::ReferenceString translated_Building_Obelisk = STRING_LITERAL_AS_REFERENCE("Obelisk of Light");
Jupiter::ReferenceString translated_Building_AdvancedGuardTower_Internals = STRING_LITERAL_AS_REFERENCE("Advanced Guard Tower");
Jupiter::ReferenceString translated_Building_Obelisk_Internals = STRING_LITERAL_AS_REFERENCE("Obelisk of Light");
static constexpr std::string_view translated_Building_AdvancedGuardTower = "Advanced Guard Tower"sv;
static constexpr std::string_view translated_Building_Obelisk = "Obelisk of Light"sv;
static constexpr std::string_view translated_Building_AdvancedGuardTower_Internals = "Advanced Guard Tower"sv;
static constexpr std::string_view translated_Building_Obelisk_Internals = "Obelisk of Light"sv;
/** Other structures */
Jupiter::ReferenceString translated_Building_Silo = STRING_LITERAL_AS_REFERENCE("Tiberium Silo");
Jupiter::ReferenceString translated_Building_CommCentre = STRING_LITERAL_AS_REFERENCE("Communications Center");
Jupiter::ReferenceString translated_Building_Silo_Internals = STRING_LITERAL_AS_REFERENCE("Tiberium Silo");
Jupiter::ReferenceString translated_Building_CommCentre_Internals = STRING_LITERAL_AS_REFERENCE("Communications Center");
static constexpr std::string_view translated_Building_Silo = "Tiberium Silo"sv;
static constexpr std::string_view translated_Building_CommCentre = "Communications Center"sv;
static constexpr std::string_view translated_Building_Silo_Internals = "Tiberium Silo"sv;
static constexpr std::string_view translated_Building_CommCentre_Internals = "Communications Center"sv;
/** Fort structures */
Jupiter::ReferenceString translated_CapturableMCT_Fort = STRING_LITERAL_AS_REFERENCE("Fort");
Jupiter::ReferenceString translated_CapturableMCT_MC = STRING_LITERAL_AS_REFERENCE("Medical Center");
Jupiter::ReferenceString translated_CapturableMCT_Fort_Internals = STRING_LITERAL_AS_REFERENCE("Fort");
Jupiter::ReferenceString translated_CapturableMCT_MC_Internals = STRING_LITERAL_AS_REFERENCE("Medical Center");
static constexpr std::string_view translated_CapturableMCT_Fort = "Fort"sv;
static constexpr std::string_view translated_CapturableMCT_MC = "Medical Center"sv;
static constexpr std::string_view translated_CapturableMCT_Fort_Internals = "Fort"sv;
static constexpr std::string_view translated_CapturableMCT_MC_Internals = "Medical Center"sv;
/** Defences */
Jupiter::ReferenceString translated_Defence_GuardTower = STRING_LITERAL_AS_REFERENCE("Guard Tower");
Jupiter::ReferenceString translated_Defence_Turret = STRING_LITERAL_AS_REFERENCE("Turret");
Jupiter::ReferenceString translated_Defence_SAMSite = STRING_LITERAL_AS_REFERENCE("SAM Site");
Jupiter::ReferenceString translated_Defence_AATower = STRING_LITERAL_AS_REFERENCE("Anti-Air Guard Tower");
Jupiter::ReferenceString translated_Defence_GunEmplacement = STRING_LITERAL_AS_REFERENCE("Gun Emplacement");
Jupiter::ReferenceString translated_Defence_RocketEmplacement = STRING_LITERAL_AS_REFERENCE("Rocket Emplacement");
static constexpr std::string_view translated_Defence_GuardTower = "Guard Tower"sv;
static constexpr std::string_view translated_Defence_Turret = "Turret"sv;
static constexpr std::string_view translated_Defence_SAMSite = "SAM Site"sv;
static constexpr std::string_view translated_Defence_AATower = "Anti-Air Guard Tower"sv;
static constexpr std::string_view translated_Defence_GunEmplacement = "Gun Emplacement"sv;
static constexpr std::string_view translated_Defence_RocketEmplacement = "Rocket Emplacement"sv;
/** Defences - Sentinels */
Jupiter::ReferenceString translated_Sentinel_AGT_MG_Base = STRING_LITERAL_AS_REFERENCE("Advanced Guard Tower");
Jupiter::ReferenceString translated_Sentinel_AGT_Rockets_Base = STRING_LITERAL_AS_REFERENCE("Advanced Guard Tower");
Jupiter::ReferenceString translated_Sentinel_Obelisk_Laser_Base = STRING_LITERAL_AS_REFERENCE("Obelisk of Light");
static constexpr std::string_view translated_Sentinel_AGT_MG_Base = "Advanced Guard Tower"sv;
static constexpr std::string_view translated_Sentinel_AGT_Rockets_Base = "Advanced Guard Tower"sv;
static constexpr std::string_view translated_Sentinel_Obelisk_Laser_Base = "Obelisk of Light"sv;
/** UT damage types */
Jupiter::ReferenceString translated_UTDmgType_VehicleExplosion = STRING_LITERAL_AS_REFERENCE("Vehicle Explosion");
Jupiter::ReferenceString translated_UTDmgType_Drowned = STRING_LITERAL_AS_REFERENCE("Drowned");
static constexpr std::string_view translated_UTDmgType_VehicleExplosion = "Vehicle Explosion"sv;
static constexpr std::string_view translated_UTDmgType_Drowned = "Drowned"sv;
/** Beacons */
Jupiter::ReferenceString translated_IonCannonBeacon = STRING_LITERAL_AS_REFERENCE("Ion Cannon Beacon");
Jupiter::ReferenceString translated_NukeBeacon = STRING_LITERAL_AS_REFERENCE("Nuclear Strike Beacon");
Jupiter::ReferenceString translated_KillZDamageType = STRING_LITERAL_AS_REFERENCE("Kill Zone");
static constexpr std::string_view translated_IonCannonBeacon = "Ion Cannon Beacon"sv;
static constexpr std::string_view translated_NukeBeacon = "Nuclear Strike Beacon"sv;
static constexpr std::string_view translated_KillZDamageType = "Kill Zone"sv;
RenX::TeamType RenX::getTeam(int teamNum)
{
@ -433,16 +432,12 @@ RenX::TeamType RenX::getEnemy(TeamType team)
}
}
std::string_view RenX::getCharacter(std::string_view chr)
{
static Jupiter::ReferenceString object;
object = chr;
if (object.find(STRING_LITERAL_AS_REFERENCE("Rx_")) == 0)
std::string_view RenX::getCharacter(std::string_view object) {
if (object.find("Rx_"sv) == 0)
object.remove_prefix(3);
if (object.find(STRING_LITERAL_AS_REFERENCE("InventoryManager_")) == 0)
if (object.find("InventoryManager_"sv) == 0)
object.remove_prefix(17);
else if (object.find(STRING_LITERAL_AS_REFERENCE("FamilyInfo_")) == 0)
else if (object.find("FamilyInfo_"sv) == 0)
object.remove_prefix(11);
return object;
@ -450,7 +445,7 @@ std::string_view RenX::getCharacter(std::string_view chr)
std::string_view translateCharacter(std::string_view object)
{
if (object.find(STRING_LITERAL_AS_REFERENCE("GDI_")) == 0)
if (object.find("GDI_"sv) == 0)
{
object.remove_prefix(4);
if (object == "Deadeye"sv) return translated_GDI_Deadeye;
@ -469,7 +464,7 @@ std::string_view translateCharacter(std::string_view object)
if (object == "Soldier"sv) return translated_GDI_Soldier;
if (object == "Sydney"sv) return translated_GDI_Sydney;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Nod_")) == 0)
else if (object.find("Nod_"sv) == 0)
{
object.remove_prefix(4);
if (object == "BlackHandSniper"sv) return translated_Nod_BlackHandSniper;
@ -492,26 +487,26 @@ std::string_view translateCharacter(std::string_view object)
return object;
}
std::string_view RenX::translateName(std::string_view obj)
{
// TODO: Use a map...
std::string_view RenX::translateName(std::string_view obj) {
if (obj.empty())
return ""_jrs;
return ""sv;
Jupiter::ReferenceString iniTranslation = RenX::getCore()->getConfig()["Name"_jrs].get(obj);
std::string_view iniTranslation = RenX::getCore()->getConfig()["Name"sv].get(obj);
if (!iniTranslation.empty())
return iniTranslation;
Jupiter::ReferenceString object = obj;
std::string_view object = obj;
if (object.find(STRING_LITERAL_AS_REFERENCE("nBab_")) == 0)
if (object.find("nBab_"sv) == 0)
object.remove_prefix(5);
if (object.find(STRING_LITERAL_AS_REFERENCE("Rx_")) == 0)
if (object.find("Rx_"sv) == 0)
object.remove_prefix(3);
else if (object.find(STRING_LITERAL_AS_REFERENCE("TS_")) == 0)
else if (object.find("TS_"sv) == 0)
object.remove_prefix(3);
if (object.find(STRING_LITERAL_AS_REFERENCE("Vehicle_")) == 0)
if (object.find("Vehicle_"sv) == 0)
{
object.remove_prefix(8);
@ -549,7 +544,7 @@ std::string_view RenX::translateName(std::string_view obj)
if (object == "AC130_DmgType_HeavyCannon"sv) return translated_Vehicle_AC130_DmgType_HeavyCannon;
if (object == "AC130_DmgType_AutoCannon"sv) return translated_Vehicle_AC130_DmgType_AutoCannon;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Weapon_")) == 0)
else if (object.find("Weapon_"sv) == 0)
{
object.remove_prefix(7);
if (object == "HeavyPistol"sv) return translated_Weapon_HeavyPistol;
@ -576,23 +571,23 @@ std::string_view RenX::translateName(std::string_view obj)
if (object == "DeployedNukeBeacon"sv) return translated_Weapon_DeployedNukeBeacon;
if (object == "CrateNuke"sv) return translated_Weapon_CrateNuke;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Projectile_")) == 0)
else if (object.find("Projectile_"sv) == 0)
{
object.remove_prefix(11);
if (object == "EMPGrenade"sv) return translated_Projectile_EMPGrenade;
if (object == "SmokeGrenade"sv) return translated_Projectile_SmokeGrenade;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("InventoryManager_")) == 0)
else if (object.find("InventoryManager_"sv) == 0)
{
object.remove_prefix(17);
return translateCharacter(object);
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("FamilyInfo_")) == 0)
else if (object.find("FamilyInfo_"sv) == 0)
{
object.remove_prefix(11);
return translateCharacter(object);
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("DmgType_")) == 0)
else if (object.find("DmgType_"sv) == 0)
{
object.remove_prefix(8);
@ -704,7 +699,7 @@ std::string_view RenX::translateName(std::string_view obj)
/** Other Vehicles */
if (object == "A10_Missile"sv) return translated_DmgType_A10_Missile;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Building_")) == 0)
else if (object.find("Building_"sv) == 0)
{
object.remove_prefix(9);
/** Nod structures */
@ -741,7 +736,7 @@ std::string_view RenX::translateName(std::string_view obj)
if (object == "Silo_Internals"sv) return translated_Building_Silo_Internals;
if (object == "CommCentre_Internals"sv) return translated_Building_CommCentre_Internals;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("CapturableMCT_")) == 0)
else if (object.find("CapturableMCT_"sv) == 0)
{
object.remove_prefix(14);
if (object == "Fort"sv) return translated_CapturableMCT_Fort;
@ -749,7 +744,7 @@ std::string_view RenX::translateName(std::string_view obj)
if (object == "Fort_Internals"sv) return translated_CapturableMCT_Fort_Internals;
if (object == "MC_Internals"sv) return translated_CapturableMCT_MC_Internals;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Defence_")) == 0)
else if (object.find("Defence_"sv) == 0)
{
object.remove_prefix(8);
if (object == "GuardTower"sv) return translated_Defence_GuardTower;
@ -759,20 +754,20 @@ std::string_view RenX::translateName(std::string_view obj)
if (object == "GunEmplacement"sv) return translated_Defence_GunEmplacement;
if (object == "RocketEmplacement"sv) return translated_Defence_RocketEmplacement;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("Sentinel_")) == 0)
else if (object.find("Sentinel_"sv) == 0)
{
object.remove_prefix(9);
if (object == "AGT_MG_Base"sv) return translated_Sentinel_AGT_MG_Base;
if (object == "AGT_Rockets_Base"sv) return translated_Sentinel_AGT_Rockets_Base;
if (object == "Obelisk_Laser_Base"sv) return translated_Sentinel_Obelisk_Laser_Base;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("UTDmgType_")) == 0)
else if (object.find("UTDmgType_"sv) == 0)
{
object.remove_prefix(10);
if (object == "VehicleExplosion"sv) return translated_UTDmgType_VehicleExplosion;
if (object == "Drowned"sv) return translated_UTDmgType_Drowned;
}
else if (object.find(STRING_LITERAL_AS_REFERENCE("VoteMenuChoice_")) == 0)
else if (object.find("VoteMenuChoice_"sv) == 0)
{
object.remove_prefix(15);
if (object == "AddBots"sv) return translated_VoteMenuChoice_AddBots;
@ -836,44 +831,44 @@ std::string_view RenX::translateWinTypePlain(RenX::WinType winType)
void RenX::initTranslations(Jupiter::Config &translationsFile)
{
NodColor = translationsFile["TeamColor"_jrs].get("Nod"_jrs, "04"_jrs);
GDIColor = translationsFile["TeamColor"_jrs].get("GDI"_jrs, "08"_jrs);
OtherColor = translationsFile["TeamColor"_jrs].get("Other"_jrs, "14"_jrs);
NodShortName = translationsFile["ShortTeamName"_jrs].get("Nod"_jrs, "Nod"_jrs);
GDIShortName = translationsFile["ShortTeamName"_jrs].get("GDI"_jrs, "GDI"_jrs);
OtherShortName = translationsFile["ShortTeamName"_jrs].get("Other"_jrs, "N/A"_jrs);
NodLongName = translationsFile["LongTeamName"_jrs].get("Nod"_jrs, "Brotherhood of Nod"_jrs);
GDILongName = translationsFile["LongTeamName"_jrs].get("GDI"_jrs, "Global Defense Initiative"_jrs);
OtherLongName = translationsFile["LongTeamName"_jrs].get("Other"_jrs, "Unknown"_jrs);
scoreWinTypeTranslation = translationsFile["WinType"_jrs].get("Score"_jrs, "Domination (High Score)"_jrs);
baseWinTypeTranslation = translationsFile["WinType"_jrs].get("Base"_jrs, "Conquest (Base Destruction)"_jrs);
beaconWinTypeTranslation = translationsFile["WinType"_jrs].get("Beacon"_jrs, "Espionage (Beacon)"_jrs);
tieWinTypeTranslation = translationsFile["WinType"_jrs].get("Tie"_jrs, "Draw (Tie)"_jrs);
shutdownWinTypeTranslation = translationsFile["WinType"_jrs].get("Shutdown"_jrs, "Ceasefire (Shutdown)"_jrs);
surrenderWinTypeTranslation = translationsFile["WinType"_jrs].get("Surrender"_jrs, "Forfeit (Surrender)"_jrs);
unknownWinTypeTranslation = translationsFile["WinType"_jrs].get("Unknown"_jrs, "Aliens (Unknown)"_jrs);
scoreWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Score"_jrs, "High Score"_jrs);
baseWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Base"_jrs, "Base Destruction"_jrs);
beaconWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Beacon"_jrs, "Beacon"_jrs);
tieWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Tie"_jrs, "Tie"_jrs);
shutdownWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Shutdown"_jrs, "Shutdown"_jrs);
surrenderWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Surrender"_jrs, "Surrender"_jrs);
unknownWinTypePlainTranslation = translationsFile["WinTypePlain"_jrs].get("Unknown"_jrs, "Unknown"_jrs);
NodColor = translationsFile["TeamColor"sv].get("Nod"sv, "04"sv);
GDIColor = translationsFile["TeamColor"sv].get("GDI"sv, "08"sv);
OtherColor = translationsFile["TeamColor"sv].get("Other"sv, "14"sv);
NodShortName = translationsFile["ShortTeamName"sv].get("Nod"sv, "Nod"sv);
GDIShortName = translationsFile["ShortTeamName"sv].get("GDI"sv, "GDI"sv);
OtherShortName = translationsFile["ShortTeamName"sv].get("Other"sv, "N/A"sv);
NodLongName = translationsFile["LongTeamName"sv].get("Nod"sv, "Brotherhood of Nod"sv);
GDILongName = translationsFile["LongTeamName"sv].get("GDI"sv, "Global Defense Initiative"sv);
OtherLongName = translationsFile["LongTeamName"sv].get("Other"sv, "Unknown"sv);
scoreWinTypeTranslation = translationsFile["WinType"sv].get("Score"sv, "Domination (High Score)"sv);
baseWinTypeTranslation = translationsFile["WinType"sv].get("Base"sv, "Conquest (Base Destruction)"sv);
beaconWinTypeTranslation = translationsFile["WinType"sv].get("Beacon"sv, "Espionage (Beacon)"sv);
tieWinTypeTranslation = translationsFile["WinType"sv].get("Tie"sv, "Draw (Tie)"sv);
shutdownWinTypeTranslation = translationsFile["WinType"sv].get("Shutdown"sv, "Ceasefire (Shutdown)"sv);
surrenderWinTypeTranslation = translationsFile["WinType"sv].get("Surrender"sv, "Forfeit (Surrender)"sv);
unknownWinTypeTranslation = translationsFile["WinType"sv].get("Unknown"sv, "Aliens (Unknown)"sv);
scoreWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Score"sv, "High Score"sv);
baseWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Base"sv, "Base Destruction"sv);
beaconWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Beacon"sv, "Beacon"sv);
tieWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Tie"sv, "Tie"sv);
shutdownWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Shutdown"sv, "Shutdown"sv);
surrenderWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Surrender"sv, "Surrender"sv);
unknownWinTypePlainTranslation = translationsFile["WinTypePlain"sv].get("Unknown"sv, "Unknown"sv);
}
Jupiter::String RenX::getFormattedPlayerName(const RenX::PlayerInfo &player)
std::string RenX::getFormattedPlayerName(const RenX::PlayerInfo &player)
{
Jupiter::String r = player.formatNamePrefix;
std::string r = player.formatNamePrefix;
r += IRCCOLOR;
r += RenX::getTeamColor(player.team);
r += player.name;
return r;
}
Jupiter::StringS RenX::formatGUID(const RenX::Map &map)
std::string RenX::formatGUID(const RenX::Map &map)
{
return string_printf("%.16llX%.16llX", map.guid[0], map.guid[1]);
}
@ -883,12 +878,12 @@ std::chrono::milliseconds RenX::getServerTime(const RenX::PlayerInfo &player)
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - player.joinTime);
}
Jupiter::StringS RenX::default_uuid_func(RenX::PlayerInfo &player)
std::string RenX::default_uuid_func(RenX::PlayerInfo &player)
{
if (player.steamid != 0U)
return string_printf("0x%.16llX", player.steamid);
return Jupiter::StringS();
return std::string();
}
double RenX::getKillDeathRatio(const RenX::PlayerInfo &player, bool includeSuicides)

7
src/Plugins/RenX/RenX.Core/RenX_Functions.h

@ -26,7 +26,6 @@
#include <chrono>
#include "Jupiter/Config.h"
#include "Jupiter/String.hpp"
#include "RenX.h"
#include "RenX_Map.h"
@ -135,7 +134,7 @@ namespace RenX
* @param player Data of the player
* @return IRC-ready version of the player's name.
*/
RENX_API Jupiter::String getFormattedPlayerName(const RenX::PlayerInfo &player);
RENX_API std::string getFormattedPlayerName(const RenX::PlayerInfo &player);
/**
* @brief Creates a string containing a human-readable version of a map's GUID
@ -143,7 +142,7 @@ namespace RenX
* @param map Map containing the GUID to interpret
* @return Human-readable map GUID
*/
RENX_API Jupiter::StringS formatGUID(const RenX::Map &map);
RENX_API std::string formatGUID(const RenX::Map &map);
/**
* @brief Calculates for how many seconds a player has been in the server.
@ -160,7 +159,7 @@ namespace RenX
* @param player Player to calculate UUID of
* @return UUID of the player based on their steam ID.
*/
RENX_API Jupiter::StringS default_uuid_func(RenX::PlayerInfo &player);
RENX_API std::string default_uuid_func(RenX::PlayerInfo &player);
/**
* @brief Calculates a player's Kill-Death ratio, based on their data.

8
src/Plugins/RenX/RenX.Core/RenX_GameCommand.cpp

@ -19,6 +19,8 @@
#include "RenX_GameCommand.h"
#include "RenX_Server.h"
using namespace std::literals;
std::vector<RenX::GameCommand*> g_GameMasterCommandList;
std::vector<RenX::GameCommand*> &RenX::GameMasterCommandList = g_GameMasterCommandList;
@ -82,14 +84,12 @@ void RenX::BasicGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *pla
}
std::string_view RenX::BasicGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Returns a basic text string.");
static constexpr std::string_view defaultHelp = "Returns a basic text string."sv;
if (m_help_message.empty()) {
return defaultHelp;
}
static Jupiter::ReferenceString please_delete_this_later_jessica;
please_delete_this_later_jessica = m_help_message;
return please_delete_this_later_jessica;
return m_help_message;
}
RenX::BasicGameCommand *RenX::BasicGameCommand::copy() {

1
src/Plugins/RenX/RenX.Core/RenX_GameCommand.h

@ -25,7 +25,6 @@
*/
#include "Jupiter/Command.h"
#include "Jupiter/String.hpp"
#include "RenX.h"
#include "RenX_Core.h" // getCore().

14
src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.cpp

@ -16,7 +16,9 @@
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include <iostream>
#include "jessilib/unicode.hpp"
#include "Jupiter/DataBuffer.h"
#include "RenX_LadderDatabase.h"
#include "RenX_Server.h"
#include "RenX_PlayerInfo.h"
@ -144,7 +146,7 @@ void RenX::LadderDatabase::process_data(Jupiter::DataBuffer &buffer, FILE *file,
entry->most_recent_ip = buffer.pop<uint32_t>();
entry->last_game = buffer.pop<time_t>();
entry->most_recent_name = buffer.pop<Jupiter::String_Strict, char>();
entry->most_recent_name = buffer.pop<std::string>();
// push data to list
if (m_head == nullptr) {
@ -206,7 +208,7 @@ std::pair<RenX::LadderDatabase::Entry *, size_t> RenX::LadderDatabase::getPlayer
return std::pair<Entry*, size_t>(itr, index);
}
}
return std::pair<Entry*, size_t>(nullptr, Jupiter::INVALID_INDEX);
return std::pair<Entry*, size_t>(nullptr, SIZE_MAX);
}
RenX::LadderDatabase::Entry *RenX::LadderDatabase::getPlayerEntryByName(std::string_view name) const {
@ -227,7 +229,7 @@ std::pair<RenX::LadderDatabase::Entry *, size_t> RenX::LadderDatabase::getPlayer
}
}
return std::pair<Entry*, size_t>(nullptr, Jupiter::INVALID_INDEX);
return std::pair<Entry*, size_t>(nullptr, SIZE_MAX);
}
RenX::LadderDatabase::Entry *RenX::LadderDatabase::getPlayerEntryByPartName(std::string_view name) const {
@ -248,7 +250,7 @@ std::pair<RenX::LadderDatabase::Entry *, size_t> RenX::LadderDatabase::getPlayer
}
}
return std::pair<Entry *, size_t>(nullptr, Jupiter::INVALID_INDEX);
return std::pair<Entry *, size_t>(nullptr, SIZE_MAX);
}
std::forward_list<RenX::LadderDatabase::Entry> RenX::LadderDatabase::getPlayerEntriesByPartName(std::string_view name, size_t max) const {
@ -593,11 +595,11 @@ void RenX::LadderDatabase::updateLadder(RenX::Server &server, const RenX::TeamTy
if (m_output_times)
{
Jupiter::StringS str = string_printf("Ladder: %zu entries sorted in %f seconds; Database written in %f seconds." ENDL,
std::string str = string_printf("Ladder: %zu entries sorted in %f seconds; Database written in %f seconds." ENDL,
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>(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)));
std::cout << std::string_view{str} << std::endl;
std::cout << str << std::endl;
server.sendLogChan(str);
}
}

1
src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.h

@ -22,7 +22,6 @@
#include <chrono>
#include <forward_list>
#include "Jupiter/Database.h"
#include "Jupiter/String.hpp"
#include "RenX.h"
/** DLL Linkage Nagging */

2
src/Plugins/RenX/RenX.Core/RenX_Map.h

@ -24,7 +24,7 @@
* @brief Defines the RenX Map class
*/
#include "Jupiter/String.hpp"
#include <string>
#include "RenX.h"
/** DLL Linkage Nagging */

14
src/Plugins/RenX/RenX.Core/RenX_PlayerInfo.h

@ -27,8 +27,6 @@
#include <chrono>
#include <mutex>
#include <thread>
#include "Jupiter/Reference_String.h"
#include "Jupiter/String.hpp"
#include "Jupiter/Config.h"
#include "RenX.h"
@ -51,10 +49,10 @@ namespace RenX
// TODO: Add backpack
std::string name;
std::string ip;
Jupiter::StringS adminType;
std::string adminType;
std::string uuid;
Jupiter::StringS character;
Jupiter::StringS vehicle;
std::string character;
std::string vehicle;
std::string hwid;
uint64_t steamid = 0;
uint32_t ip32 = 0;
@ -103,8 +101,8 @@ namespace RenX
void start_resolve_rdns();
bool rdns_pending = false;
mutable Jupiter::StringS gamePrefix;
mutable Jupiter::StringS formatNamePrefix;
mutable std::string gamePrefix;
mutable std::string formatNamePrefix;
mutable int access = 0;
mutable Jupiter::Config varData; // TODO: use jessilib::object instead
@ -112,7 +110,7 @@ namespace RenX
std::shared_ptr<std::string> m_rdns_ptr; // Needs synchronization across threads
};
static std::string_view rdns_pending{ "RDNS_PENDING" };
static constexpr std::string_view rdns_pending{ "RDNS_PENDING" };
}
/** Re-enable warnings */

2
src/Plugins/RenX/RenX.Core/RenX_Plugin.cpp

@ -73,7 +73,7 @@ void RenX::Plugin::RenX_OnServerDisconnect(Server &, RenX::DisconnectReason) {
return;
}
bool RenX::Plugin::RenX_OnBan(Server &, const PlayerInfo &, Jupiter::StringType &) {
bool RenX::Plugin::RenX_OnBan(Server &, const PlayerInfo &, std::string &) {
return false;
}

3
src/Plugins/RenX/RenX.Core/RenX_Plugin.h

@ -25,7 +25,6 @@
*/
#include "Jupiter/Plugin.h"
#include "Jupiter/String_Type.h"
#include "RenX.h"
namespace RenX
@ -54,7 +53,7 @@ namespace RenX
virtual void RenX_OnServerCreate(Server &server);
virtual void RenX_OnServerFullyConnected(Server &server);
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, std::string &data);
virtual void RenX_OnCommandTriggered(Server& server, std::string_view trigger, RenX::PlayerInfo& player, std::string_view parameters, GameCommand& command);
/** Player type logs */

501
src/Plugins/RenX/RenX.Core/RenX_Server.cpp

File diff suppressed because it is too large

16
src/Plugins/RenX/RenX.Core/RenX_Server.h

@ -26,8 +26,8 @@
#include <chrono>
#include <list>
#include <vector>
#include "Jupiter/TCPSocket.h"
#include "Jupiter/String.hpp"
#include "Jupiter/Config.h"
#include "Jupiter/Thinker.h"
#include "Jupiter/Rehash.h"
@ -83,7 +83,7 @@ namespace RenX
public: // RenX::Server
std::list<RenX::PlayerInfo> players; /** A list of players in the server */
std::vector<std::unique_ptr<RenX::BuildingInfo>> buildings; /** A list of buildings in the server */
std::vector<Jupiter::StringS> mutators; /** A list of buildings the server is running */
std::vector<std::string> mutators; /** A list of buildings the server is running */
std::vector<RenX::Map> maps; /** A list of maps in the server's rotation */
Jupiter::Config varData; /** Variable data. */
@ -394,7 +394,7 @@ namespace RenX
* @param player Player to fetch Steam ID from
* @return A player's formatted Steam ID on success, an empty string otherwise.
*/
Jupiter::StringS formatSteamID(const RenX::PlayerInfo &player) const;
std::string formatSteamID(const RenX::PlayerInfo &player) const;
/**
* @brief Formats a Steam ID into a readable string.
@ -402,7 +402,7 @@ namespace RenX
* @param id Steam ID to format
* @return A player's formatted Steam ID on success, an empty string otherwise.
*/
Jupiter::StringS formatSteamID(uint64_t id) const;
std::string formatSteamID(uint64_t id) const;
/**
* @brief Kicks a player from the server.
@ -912,7 +912,7 @@ namespace RenX
* @param player Player to calculate UUID of
* @return UUID calculated from player.
*/
typedef Jupiter::StringS(*uuid_func)(RenX::PlayerInfo &player);
typedef std::string(*uuid_func)(RenX::PlayerInfo &player);
/**
* @brief Sets the player UUID calculation function.
@ -1113,7 +1113,7 @@ namespace RenX
std::string m_lastLine;
std::string m_rconUser;
std::string m_gameVersion;
Jupiter::StringS m_serverName;
std::string m_serverName;
std::string m_lastCommand;
std::string m_lastCommandParams;
RenX::Map m_map;
@ -1145,8 +1145,8 @@ namespace RenX
std::string m_hostname;
std::string m_pass;
std::string m_configSection;
Jupiter::StringS m_rules;
Jupiter::StringS m_ban_from_str;
std::string m_rules;
std::string m_ban_from_str;
std::string m_IRCPrefix;
std::string m_CommandPrefix;
Jupiter::Config* m_commandAccessLevels;

360
src/Plugins/RenX/RenX.Core/RenX_Tags.cpp

@ -16,7 +16,6 @@
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include "Jupiter/Reference_String.h"
#include "Jupiter/IRC_Client.h"
#include "RenX_Core.h"
#include "RenX_Functions.h"
@ -26,7 +25,7 @@
#include "RenX_Plugin.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
struct TagsImp : RenX::Tags
{
@ -36,7 +35,7 @@ struct TagsImp : RenX::Tags
void sanitizeTags(std::string& fmt);
std::string_view getUniqueInternalTag();
private:
Jupiter::StringS uniqueTag;
std::string uniqueTag;
uint32_t tagItr;
size_t bar_width;
} _tags;
@ -50,16 +49,16 @@ bool RenX::Tags::initialize()
bool TagsImp::initialize()
{
this->tagItr = 0;
this->uniqueTag = "\0\0\0\0\0\0"_jrs;
this->uniqueTag = "\0\0\0\0\0\0"sv;
Jupiter::Config &config = RenX::getCore()->getConfig();
std::string_view configSection = config.get("TagDefinitions"_jrs, "Tags"_jrs);
std::string_view configSection = config.get("TagDefinitions"sv, "Tags"sv);
TagsImp::bar_width = config[configSection].get<int>("BarWidth"_jrs, 19);
TagsImp::bar_width = config[configSection].get<int>("BarWidth"sv, 19);
/** Global formats */
this->dateFmt = static_cast<std::string>(config[configSection].get("DateFormat"_jrs, "%A, %B %d, %Y"_jrs));
this->timeFmt = static_cast<std::string>(config[configSection].get("TimeFormat"_jrs, "%H:%M:%S"_jrs));
this->dateFmt = static_cast<std::string>(config[configSection].get("DateFormat"sv, "%A, %B %d, %Y"sv));
this->timeFmt = static_cast<std::string>(config[configSection].get("TimeFormat"sv, "%H:%M:%S"sv));
/** Internal message tags */
@ -250,188 +249,188 @@ bool TagsImp::initialize()
/** External (config) tags */
/** Global tags */
this->dateTag = config[configSection].get("DateTag"_jrs, "{DATE}"_jrs);
this->timeTag = config[configSection].get("TimeTag"_jrs, "{TIME}"_jrs);
this->dateTag = config[configSection].get("DateTag"sv, "{DATE}"sv);
this->timeTag = config[configSection].get("TimeTag"sv, "{TIME}"sv);
/** Server tags */
this->rconVersionTag = config[configSection].get("RCONVersionTag"_jrs, "{RVER}"_jrs);
this->gameVersionTag = config[configSection].get("GameVersionTag"_jrs, "{GVER}"_jrs);
this->rulesTag = config[configSection].get("RulesTag"_jrs, "{RULES}"_jrs);
this->userTag = config[configSection].get("UserTag"_jrs, "{USER}"_jrs);
this->serverNameTag = config[configSection].get("ServerNameTag"_jrs, "{SERVERNAME}"_jrs);
this->mapTag = config[configSection].get("MapTag"_jrs, "{MAP}"_jrs);
this->mapGUIDTag = config[configSection].get("MapGUIDTag"_jrs, "{MGUID}"_jrs);
this->serverHostnameTag = config[configSection].get("ServerHostnameTag"_jrs, "{SERVERHOST}"_jrs);
this->serverPortTag = config[configSection].get("ServerPortTag"_jrs, "{SERVERPORT}"_jrs);
this->socketHostnameTag = config[configSection].get("SocketHostnameTag"_jrs, "{SOCKHOST}"_jrs);
this->socketPortTag = config[configSection].get("SocketPortTag"_jrs, "{SOCKPORT}"_jrs);
this->serverPrefixTag = config[configSection].get("ServerPrefixTag"_jrs, "{SERVERPREFIX}"_jrs);
this->rconVersionTag = config[configSection].get("RCONVersionTag"sv, "{RVER}"sv);
this->gameVersionTag = config[configSection].get("GameVersionTag"sv, "{GVER}"sv);
this->rulesTag = config[configSection].get("RulesTag"sv, "{RULES}"sv);
this->userTag = config[configSection].get("UserTag"sv, "{USER}"sv);
this->serverNameTag = config[configSection].get("ServerNameTag"sv, "{SERVERNAME}"sv);
this->mapTag = config[configSection].get("MapTag"sv, "{MAP}"sv);
this->mapGUIDTag = config[configSection].get("MapGUIDTag"sv, "{MGUID}"sv);
this->serverHostnameTag = config[configSection].get("ServerHostnameTag"sv, "{SERVERHOST}"sv);
this->serverPortTag = config[configSection].get("ServerPortTag"sv, "{SERVERPORT}"sv);
this->socketHostnameTag = config[configSection].get("SocketHostnameTag"sv, "{SOCKHOST}"sv);
this->socketPortTag = config[configSection].get("SocketPortTag"sv, "{SOCKPORT}"sv);
this->serverPrefixTag = config[configSection].get("ServerPrefixTag"sv, "{SERVERPREFIX}"sv);
/** Player tags */
this->nameTag = config[configSection].get("NameTag"_jrs, "{NAME}"_jrs);
this->rawNameTag = config[configSection].get("RawNameTag"_jrs, "{RNAME}"_jrs);
this->ipTag = config[configSection].get("IPTag"_jrs, "{IP}"_jrs);
this->hwidTag = config[configSection].get("HWIDTag"_jrs, "{HWID}"_jrs);
this->rdnsTag = config[configSection].get("RDNSTag"_jrs, "{RDNS}"_jrs);
this->steamTag = config[configSection].get("SteamTag"_jrs, "{STEAM}"_jrs);
this->uuidTag = config[configSection].get("UUIDTag"_jrs, "{UUID}"_jrs);
this->idTag = config[configSection].get("IDTag"_jrs, "{ID}"_jrs);
this->characterTag = config[configSection].get("CharacterTag"_jrs, "{CHAR}"_jrs);
this->vehicleTag = config[configSection].get("VehicleTag"_jrs, "{VEH}"_jrs);
this->adminTag = config[configSection].get("AdminTag"_jrs, "{ADMIN}"_jrs);
this->prefixTag = config[configSection].get("PrefixTag"_jrs, "{PREFIX}"_jrs);
this->gamePrefixTag = config[configSection].get("GamePrefixTag"_jrs, "{GPREFIX}"_jrs);
this->teamColorTag = config[configSection].get("TeamColorTag"_jrs, "{TCOLOR}"_jrs);
this->teamShortTag = config[configSection].get("ShortTeamTag"_jrs, "{TEAMS}"_jrs);
this->teamLongTag = config[configSection].get("LongTeamTag"_jrs, "{TEAML}"_jrs);
this->pingTag = config[configSection].get("PingTag"_jrs, "{PING}"_jrs);
this->scoreTag = config[configSection].get("ScoreTag"_jrs, "{SCORE}"_jrs);
this->scorePerMinuteTag = config[configSection].get("ScorePerMinuteTag"_jrs, "{SPM}"_jrs);
this->creditsTag = config[configSection].get("CreditsTag"_jrs, "{CREDITS}"_jrs);
this->killsTag = config[configSection].get("KillsTag"_jrs, "{KILLS}"_jrs);
this->deathsTag = config[configSection].get("DeathsTag"_jrs, "{DEATHS}"_jrs);
this->kdrTag = config[configSection].get("KDRTag"_jrs, "{KDR}"_jrs);
this->suicidesTag = config[configSection].get("SuicidesTag"_jrs, "{SUICIDES}"_jrs);
this->headshotsTag = config[configSection].get("HeadshotsTag"_jrs, "{HEADSHOTS}"_jrs);
this->headshotKillRatioTag = config[configSection].get("HeadshotKillRatioTag"_jrs, "{HSKR}"_jrs);
this->vehicleKillsTag = config[configSection].get("VehicleKillsTag"_jrs, "{VEHICLEKILLS}"_jrs);
this->buildingKillsTag = config[configSection].get("BuildingKillsTag"_jrs, "{BUILDINGKILLS}"_jrs);
this->defenceKillsTag = config[configSection].get("DefenceKillsTag"_jrs, "{DEFENCEKILLS}"_jrs);
this->gameTimeTag = config[configSection].get("GameTimeTag"_jrs, "{GAMETIME}"_jrs);
this->gamesTag = config[configSection].get("GamesTag"_jrs, "{GAMES}"_jrs);
this->GDIGamesTag = config[configSection].get("GDIGamesTag"_jrs, "{GDIGAMES}"_jrs);
this->NodGamesTag = config[configSection].get("NodGamesTag"_jrs, "{NODGAMES}"_jrs);
this->winsTag = config[configSection].get("WinsTag"_jrs, "{WINS}"_jrs);
this->GDIWinsTag = config[configSection].get("GDIWinsTag"_jrs, "{GDIWINS}"_jrs);
this->NodWinsTag = config[configSection].get("NodWinsTag"_jrs, "{NODWINS}"_jrs);
this->tiesTag = config[configSection].get("TiesTag"_jrs, "{TIES}"_jrs);
this->lossesTag = config[configSection].get("LossesTag"_jrs, "{LOSSES}"_jrs);
this->GDILossesTag = config[configSection].get("GDILossesTag"_jrs, "{GDILOSSES}"_jrs);
this->NodLossesTag = config[configSection].get("NodLossesTag"_jrs, "{NODLOSSES}"_jrs);
this->winLossRatioTag = config[configSection].get("WinLossRatioTag"_jrs, "{WLR}"_jrs);
this->GDIWinLossRatioTag = config[configSection].get("GDIWinLossRatioTag"_jrs, "{GDIWLR}"_jrs);
this->NodWinLossRatioTag = config[configSection].get("NodWinLossRatioTag"_jrs, "{NODWLR}"_jrs);
this->beaconPlacementsTag = config[configSection].get("BeaconPlacementsTag"_jrs, "{BEACONPLACEMENTS}"_jrs);
this->beaconDisarmsTag = config[configSection].get("BeaconDisarmsTag"_jrs, "{BEACONDISARMS}"_jrs);
this->proxyPlacementsTag = config[configSection].get("ProxyPlacementsTag"_jrs, "{PROXYPLACEMENTS}"_jrs);
this->proxyDisarmsTag = config[configSection].get("ProxyDisarmsTag"_jrs, "{PROXYDISARMS}"_jrs);
this->capturesTag = config[configSection].get("CapturesTag"_jrs, "{CAPTURES}"_jrs);
this->stealsTag = config[configSection].get("StealsTag"_jrs, "{STEALS}"_jrs);
this->stolenTag = config[configSection].get("StolenTag"_jrs, "{STOLEN}"_jrs);
this->accessTag = config[configSection].get("AccessTag"_jrs, "{ACCESS}"_jrs);
this->nameTag = config[configSection].get("NameTag"sv, "{NAME}"sv);
this->rawNameTag = config[configSection].get("RawNameTag"sv, "{RNAME}"sv);
this->ipTag = config[configSection].get("IPTag"sv, "{IP}"sv);
this->hwidTag = config[configSection].get("HWIDTag"sv, "{HWID}"sv);
this->rdnsTag = config[configSection].get("RDNSTag"sv, "{RDNS}"sv);
this->steamTag = config[configSection].get("SteamTag"sv, "{STEAM}"sv);
this->uuidTag = config[configSection].get("UUIDTag"sv, "{UUID}"sv);
this->idTag = config[configSection].get("IDTag"sv, "{ID}"sv);
this->characterTag = config[configSection].get("CharacterTag"sv, "{CHAR}"sv);
this->vehicleTag = config[configSection].get("VehicleTag"sv, "{VEH}"sv);
this->adminTag = config[configSection].get("AdminTag"sv, "{ADMIN}"sv);
this->prefixTag = config[configSection].get("PrefixTag"sv, "{PREFIX}"sv);
this->gamePrefixTag = config[configSection].get("GamePrefixTag"sv, "{GPREFIX}"sv);
this->teamColorTag = config[configSection].get("TeamColorTag"sv, "{TCOLOR}"sv);
this->teamShortTag = config[configSection].get("ShortTeamTag"sv, "{TEAMS}"sv);
this->teamLongTag = config[configSection].get("LongTeamTag"sv, "{TEAML}"sv);
this->pingTag = config[configSection].get("PingTag"sv, "{PING}"sv);
this->scoreTag = config[configSection].get("ScoreTag"sv, "{SCORE}"sv);
this->scorePerMinuteTag = config[configSection].get("ScorePerMinuteTag"sv, "{SPM}"sv);
this->creditsTag = config[configSection].get("CreditsTag"sv, "{CREDITS}"sv);
this->killsTag = config[configSection].get("KillsTag"sv, "{KILLS}"sv);
this->deathsTag = config[configSection].get("DeathsTag"sv, "{DEATHS}"sv);
this->kdrTag = config[configSection].get("KDRTag"sv, "{KDR}"sv);
this->suicidesTag = config[configSection].get("SuicidesTag"sv, "{SUICIDES}"sv);
this->headshotsTag = config[configSection].get("HeadshotsTag"sv, "{HEADSHOTS}"sv);
this->headshotKillRatioTag = config[configSection].get("HeadshotKillRatioTag"sv, "{HSKR}"sv);
this->vehicleKillsTag = config[configSection].get("VehicleKillsTag"sv, "{VEHICLEKILLS}"sv);
this->buildingKillsTag = config[configSection].get("BuildingKillsTag"sv, "{BUILDINGKILLS}"sv);
this->defenceKillsTag = config[configSection].get("DefenceKillsTag"sv, "{DEFENCEKILLS}"sv);
this->gameTimeTag = config[configSection].get("GameTimeTag"sv, "{GAMETIME}"sv);
this->gamesTag = config[configSection].get("GamesTag"sv, "{GAMES}"sv);
this->GDIGamesTag = config[configSection].get("GDIGamesTag"sv, "{GDIGAMES}"sv);
this->NodGamesTag = config[configSection].get("NodGamesTag"sv, "{NODGAMES}"sv);
this->winsTag = config[configSection].get("WinsTag"sv, "{WINS}"sv);
this->GDIWinsTag = config[configSection].get("GDIWinsTag"sv, "{GDIWINS}"sv);
this->NodWinsTag = config[configSection].get("NodWinsTag"sv, "{NODWINS}"sv);
this->tiesTag = config[configSection].get("TiesTag"sv, "{TIES}"sv);
this->lossesTag = config[configSection].get("LossesTag"sv, "{LOSSES}"sv);
this->GDILossesTag = config[configSection].get("GDILossesTag"sv, "{GDILOSSES}"sv);
this->NodLossesTag = config[configSection].get("NodLossesTag"sv, "{NODLOSSES}"sv);
this->winLossRatioTag = config[configSection].get("WinLossRatioTag"sv, "{WLR}"sv);
this->GDIWinLossRatioTag = config[configSection].get("GDIWinLossRatioTag"sv, "{GDIWLR}"sv);
this->NodWinLossRatioTag = config[configSection].get("NodWinLossRatioTag"sv, "{NODWLR}"sv);
this->beaconPlacementsTag = config[configSection].get("BeaconPlacementsTag"sv, "{BEACONPLACEMENTS}"sv);
this->beaconDisarmsTag = config[configSection].get("BeaconDisarmsTag"sv, "{BEACONDISARMS}"sv);
this->proxyPlacementsTag = config[configSection].get("ProxyPlacementsTag"sv, "{PROXYPLACEMENTS}"sv);
this->proxyDisarmsTag = config[configSection].get("ProxyDisarmsTag"sv, "{PROXYDISARMS}"sv);
this->capturesTag = config[configSection].get("CapturesTag"sv, "{CAPTURES}"sv);
this->stealsTag = config[configSection].get("StealsTag"sv, "{STEALS}"sv);
this->stolenTag = config[configSection].get("StolenTag"sv, "{STOLEN}"sv);
this->accessTag = config[configSection].get("AccessTag"sv, "{ACCESS}"sv);
/** Victim player tags */
this->victimNameTag = config[configSection].get("VictimNameTag"_jrs, "{VNAME}"_jrs);
this->victimRawNameTag = config[configSection].get("VictimRawNameTag"_jrs, "{VRNAME}"_jrs);
this->victimIPTag = config[configSection].get("VictimIPTag"_jrs, "{VIP}"_jrs);
this->victimHWIDTag = config[configSection].get("VictimHWIDTag"_jrs, "{VHWID}"_jrs);
this->victimRDNSTag = config[configSection].get("VictimRDNSTag"_jrs, "{VRDNS}"_jrs);
this->victimSteamTag = config[configSection].get("VictimSteamTag"_jrs, "{VSTEAM}"_jrs);
this->victimUUIDTag = config[configSection].get("VictimUUIDTag"_jrs, "{VUUID}"_jrs);
this->victimIDTag = config[configSection].get("VictimIDTag"_jrs, "{VID}"_jrs);
this->victimCharacterTag = config[configSection].get("VictimCharacterTag"_jrs, "{VCHAR}"_jrs);
this->victimVehicleTag = config[configSection].get("VictimVehicleTag"_jrs, "{VVEH}"_jrs);
this->victimAdminTag = config[configSection].get("VictimAdminTag"_jrs, "{VADMIN}"_jrs);
this->victimPrefixTag = config[configSection].get("VictimPrefixTag"_jrs, "{VPREFIX}"_jrs);
this->victimGamePrefixTag = config[configSection].get("VictimGamePrefixTag"_jrs, "{VGPREFIX}"_jrs);
this->victimTeamColorTag = config[configSection].get("VictimTeamColorTag"_jrs, "{VTCOLOR}"_jrs);
this->victimTeamShortTag = config[configSection].get("VictimShortTeamTag"_jrs, "{VTEAMS}"_jrs);
this->victimTeamLongTag = config[configSection].get("VictimLongTeamTag"_jrs, "{VTEAML}"_jrs);
this->victimPingTag = config[configSection].get("VictimPingTag"_jrs, "{VPING}"_jrs);
this->victimScoreTag = config[configSection].get("VictimScoreTag"_jrs, "{VSCORE}"_jrs);
this->victimScorePerMinuteTag = config[configSection].get("VictimScorePerMinuteTag"_jrs, "{VSPM}"_jrs);
this->victimCreditsTag = config[configSection].get("VictimCreditsTag"_jrs, "{VCREDITS}"_jrs);
this->victimKillsTag = config[configSection].get("VictimKillsTag"_jrs, "{VKILLS}"_jrs);
this->victimDeathsTag = config[configSection].get("VictimDeathsTag"_jrs, "{VDEATHS}"_jrs);
this->victimKDRTag = config[configSection].get("VictimKDRTag"_jrs, "{VKDR}"_jrs);
this->victimSuicidesTag = config[configSection].get("VictimSuicidesTag"_jrs, "{VSUICIDES}"_jrs);
this->victimHeadshotsTag = config[configSection].get("VictimHeadshotsTag"_jrs, "{VHEADSHOTS}"_jrs);
this->victimHeadshotKillRatioTag = config[configSection].get("VictimHeadshotKillRatioTag"_jrs, "{VHSKR}"_jrs);
this->victimVehicleKillsTag = config[configSection].get("VictimVehicleKillsTag"_jrs, "{VVEHICLEKILLS}"_jrs);
this->victimBuildingKillsTag = config[configSection].get("VictimBuildingKillsTag"_jrs, "{VBUILDINGKILLS}"_jrs);
this->victimDefenceKillsTag = config[configSection].get("VictimDefenceKillsTag"_jrs, "{VDEFENCEKILLS}"_jrs);
this->victimGameTimeTag = config[configSection].get("VictimGameTimeTag"_jrs, "{VGAMETIME}"_jrs);
this->victimGamesTag = config[configSection].get("VictimGamesTag"_jrs, "{VGAMES}"_jrs);
this->victimGDIGamesTag = config[configSection].get("VictimGDIGamesTag"_jrs, "{VGDIGAMES}"_jrs);
this->victimNodGamesTag = config[configSection].get("VictimNodGamesTag"_jrs, "{VNODGAMES}"_jrs);
this->victimWinsTag = config[configSection].get("VictimWinsTag"_jrs, "{VWINS}"_jrs);
this->victimGDIWinsTag = config[configSection].get("VictimGDIWinsTag"_jrs, "{VGDIWINS}"_jrs);
this->victimNodWinsTag = config[configSection].get("VictimNodWinsTag"_jrs, "{VNODWINS}"_jrs);
this->victimTiesTag = config[configSection].get("VictimTiesTag"_jrs, "{VTIES}"_jrs);
this->victimLossesTag = config[configSection].get("VictimLossesTag"_jrs, "{VLOSSES}"_jrs);
this->victimGDILossesTag = config[configSection].get("VictimGDILossesTag"_jrs, "{VGDILOSSES}"_jrs);
this->victimNodLossesTag = config[configSection].get("VictimNodLossesTag"_jrs, "{VNODLOSSES}"_jrs);
this->victimWinLossRatioTag = config[configSection].get("VictimWinLossRatioTag"_jrs, "{VWLR}"_jrs);
this->victimGDIWinLossRatioTag = config[configSection].get("VictimGDIWinLossRatioTag"_jrs, "{VGDIWLR}"_jrs);
this->victimNodWinLossRatioTag = config[configSection].get("VictimNodWinLossRatioTag"_jrs, "{VNODWLR}"_jrs);
this->victimBeaconPlacementsTag = config[configSection].get("VictimBeaconPlacementsTag"_jrs, "{VBEACONPLACEMENTS}"_jrs);
this->victimBeaconDisarmsTag = config[configSection].get("VictimBeaconDisarmsTag"_jrs, "{VBEACONDISARMS}"_jrs);
this->victimProxyPlacementsTag = config[configSection].get("VictimProxyPlacementsTag"_jrs, "{VPROXYPLACEMENTS}"_jrs);
this->victimProxyDisarmsTag = config[configSection].get("VictimProxyDisarmsTag"_jrs, "{VPROXYDISARMS}"_jrs);
this->victimCapturesTag = config[configSection].get("VictimCapturesTag"_jrs, "{VCAPTURES}"_jrs);
this->victimStealsTag = config[configSection].get("VictimStealsTag"_jrs, "{VSTEALS}"_jrs);
this->victimStolenTag = config[configSection].get("VictimStolenTag"_jrs, "{VSTOLEN}"_jrs);
this->victimAccessTag = config[configSection].get("VictimAccessTag"_jrs, "{VACCESS}"_jrs);
this->victimNameTag = config[configSection].get("VictimNameTag"sv, "{VNAME}"sv);
this->victimRawNameTag = config[configSection].get("VictimRawNameTag"sv, "{VRNAME}"sv);
this->victimIPTag = config[configSection].get("VictimIPTag"sv, "{VIP}"sv);
this->victimHWIDTag = config[configSection].get("VictimHWIDTag"sv, "{VHWID}"sv);
this->victimRDNSTag = config[configSection].get("VictimRDNSTag"sv, "{VRDNS}"sv);
this->victimSteamTag = config[configSection].get("VictimSteamTag"sv, "{VSTEAM}"sv);
this->victimUUIDTag = config[configSection].get("VictimUUIDTag"sv, "{VUUID}"sv);
this->victimIDTag = config[configSection].get("VictimIDTag"sv, "{VID}"sv);
this->victimCharacterTag = config[configSection].get("VictimCharacterTag"sv, "{VCHAR}"sv);
this->victimVehicleTag = config[configSection].get("VictimVehicleTag"sv, "{VVEH}"sv);
this->victimAdminTag = config[configSection].get("VictimAdminTag"sv, "{VADMIN}"sv);
this->victimPrefixTag = config[configSection].get("VictimPrefixTag"sv, "{VPREFIX}"sv);
this->victimGamePrefixTag = config[configSection].get("VictimGamePrefixTag"sv, "{VGPREFIX}"sv);
this->victimTeamColorTag = config[configSection].get("VictimTeamColorTag"sv, "{VTCOLOR}"sv);
this->victimTeamShortTag = config[configSection].get("VictimShortTeamTag"sv, "{VTEAMS}"sv);
this->victimTeamLongTag = config[configSection].get("VictimLongTeamTag"sv, "{VTEAML}"sv);
this->victimPingTag = config[configSection].get("VictimPingTag"sv, "{VPING}"sv);
this->victimScoreTag = config[configSection].get("VictimScoreTag"sv, "{VSCORE}"sv);
this->victimScorePerMinuteTag = config[configSection].get("VictimScorePerMinuteTag"sv, "{VSPM}"sv);
this->victimCreditsTag = config[configSection].get("VictimCreditsTag"sv, "{VCREDITS}"sv);
this->victimKillsTag = config[configSection].get("VictimKillsTag"sv, "{VKILLS}"sv);
this->victimDeathsTag = config[configSection].get("VictimDeathsTag"sv, "{VDEATHS}"sv);
this->victimKDRTag = config[configSection].get("VictimKDRTag"sv, "{VKDR}"sv);
this->victimSuicidesTag = config[configSection].get("VictimSuicidesTag"sv, "{VSUICIDES}"sv);
this->victimHeadshotsTag = config[configSection].get("VictimHeadshotsTag"sv, "{VHEADSHOTS}"sv);
this->victimHeadshotKillRatioTag = config[configSection].get("VictimHeadshotKillRatioTag"sv, "{VHSKR}"sv);
this->victimVehicleKillsTag = config[configSection].get("VictimVehicleKillsTag"sv, "{VVEHICLEKILLS}"sv);
this->victimBuildingKillsTag = config[configSection].get("VictimBuildingKillsTag"sv, "{VBUILDINGKILLS}"sv);
this->victimDefenceKillsTag = config[configSection].get("VictimDefenceKillsTag"sv, "{VDEFENCEKILLS}"sv);
this->victimGameTimeTag = config[configSection].get("VictimGameTimeTag"sv, "{VGAMETIME}"sv);
this->victimGamesTag = config[configSection].get("VictimGamesTag"sv, "{VGAMES}"sv);
this->victimGDIGamesTag = config[configSection].get("VictimGDIGamesTag"sv, "{VGDIGAMES}"sv);
this->victimNodGamesTag = config[configSection].get("VictimNodGamesTag"sv, "{VNODGAMES}"sv);
this->victimWinsTag = config[configSection].get("VictimWinsTag"sv, "{VWINS}"sv);
this->victimGDIWinsTag = config[configSection].get("VictimGDIWinsTag"sv, "{VGDIWINS}"sv);
this->victimNodWinsTag = config[configSection].get("VictimNodWinsTag"sv, "{VNODWINS}"sv);
this->victimTiesTag = config[configSection].get("VictimTiesTag"sv, "{VTIES}"sv);
this->victimLossesTag = config[configSection].get("VictimLossesTag"sv, "{VLOSSES}"sv);
this->victimGDILossesTag = config[configSection].get("VictimGDILossesTag"sv, "{VGDILOSSES}"sv);
this->victimNodLossesTag = config[configSection].get("VictimNodLossesTag"sv, "{VNODLOSSES}"sv);
this->victimWinLossRatioTag = config[configSection].get("VictimWinLossRatioTag"sv, "{VWLR}"sv);
this->victimGDIWinLossRatioTag = config[configSection].get("VictimGDIWinLossRatioTag"sv, "{VGDIWLR}"sv);
this->victimNodWinLossRatioTag = config[configSection].get("VictimNodWinLossRatioTag"sv, "{VNODWLR}"sv);
this->victimBeaconPlacementsTag = config[configSection].get("VictimBeaconPlacementsTag"sv, "{VBEACONPLACEMENTS}"sv);
this->victimBeaconDisarmsTag = config[configSection].get("VictimBeaconDisarmsTag"sv, "{VBEACONDISARMS}"sv);
this->victimProxyPlacementsTag = config[configSection].get("VictimProxyPlacementsTag"sv, "{VPROXYPLACEMENTS}"sv);
this->victimProxyDisarmsTag = config[configSection].get("VictimProxyDisarmsTag"sv, "{VPROXYDISARMS}"sv);
this->victimCapturesTag = config[configSection].get("VictimCapturesTag"sv, "{VCAPTURES}"sv);
this->victimStealsTag = config[configSection].get("VictimStealsTag"sv, "{VSTEALS}"sv);
this->victimStolenTag = config[configSection].get("VictimStolenTag"sv, "{VSTOLEN}"sv);
this->victimAccessTag = config[configSection].get("VictimAccessTag"sv, "{VACCESS}"sv);
/** Building tags */
this->buildingNameTag = config[configSection].get("BuildingNameTag"_jrs, "{BNAME}"_jrs);
this->buildingRawNameTag = config[configSection].get("BuildingRawNameTag"_jrs, "{BRNAME}"_jrs);
this->buildingHealthTag = config[configSection].get("BuildingHealthTag"_jrs, "{BHEALTH}"_jrs);
this->buildingMaxHealthTag = config[configSection].get("BuildingMaxHealthTag"_jrs, "{BMHEALTH}"_jrs);
this->buildingHealthPercentageTag = config[configSection].get("BuildingHealthPercentageTag"_jrs, "{BHP}"_jrs);
this->buildingArmorTag = config[configSection].get("BuildingArmorTag"_jrs, "{BARMOR}"_jrs);
this->buildingMaxArmorTag = config[configSection].get("BuildingMaxArmorTag"_jrs, "{BMARMOR}"_jrs);
this->buildingArmorPercentageTag = config[configSection].get("BuildingArmorPercentageTag"_jrs, "{BAP}"_jrs);
this->buildingDurabilityTag = config[configSection].get("BuildingDurabilityTag"_jrs, "{BDURABILITY}"_jrs);
this->buildingMaxDurabilityTag = config[configSection].get("BuildingMaxDurabilityTag"_jrs, "{BMDURABILITY}"_jrs);
this->buildingDurabilityPercentageTag = config[configSection].get("BuildingDurabilityPercentageTag"_jrs, "{BDP}"_jrs);
this->buildingTeamColorTag = config[configSection].get("BuildingTeamColorTag"_jrs, "{BCOLOR}"_jrs);
this->buildingTeamShortTag = config[configSection].get("BuildingShortTeamTag"_jrs, "{BTEAMS}"_jrs);
this->buildingTeamLongTag = config[configSection].get("BuildingLongTeamTag"_jrs, "{BTEAML}"_jrs);
this->buildingNameTag = config[configSection].get("BuildingNameTag"sv, "{BNAME}"sv);
this->buildingRawNameTag = config[configSection].get("BuildingRawNameTag"sv, "{BRNAME}"sv);
this->buildingHealthTag = config[configSection].get("BuildingHealthTag"sv, "{BHEALTH}"sv);
this->buildingMaxHealthTag = config[configSection].get("BuildingMaxHealthTag"sv, "{BMHEALTH}"sv);
this->buildingHealthPercentageTag = config[configSection].get("BuildingHealthPercentageTag"sv, "{BHP}"sv);
this->buildingArmorTag = config[configSection].get("BuildingArmorTag"sv, "{BARMOR}"sv);
this->buildingMaxArmorTag = config[configSection].get("BuildingMaxArmorTag"sv, "{BMARMOR}"sv);
this->buildingArmorPercentageTag = config[configSection].get("BuildingArmorPercentageTag"sv, "{BAP}"sv);
this->buildingDurabilityTag = config[configSection].get("BuildingDurabilityTag"sv, "{BDURABILITY}"sv);
this->buildingMaxDurabilityTag = config[configSection].get("BuildingMaxDurabilityTag"sv, "{BMDURABILITY}"sv);
this->buildingDurabilityPercentageTag = config[configSection].get("BuildingDurabilityPercentageTag"sv, "{BDP}"sv);
this->buildingTeamColorTag = config[configSection].get("BuildingTeamColorTag"sv, "{BCOLOR}"sv);
this->buildingTeamShortTag = config[configSection].get("BuildingShortTeamTag"sv, "{BTEAMS}"sv);
this->buildingTeamLongTag = config[configSection].get("BuildingLongTeamTag"sv, "{BTEAML}"sv);
/** Ladder tags */
this->rankTag = config[configSection].get("RankTag"_jrs, "{RANK}"_jrs);
this->lastGameTag = config[configSection].get("LastGameTag"_jrs, "{LASTGAME}"_jrs);
this->GDIScoreTag = config[configSection].get("GDIScoreTag"_jrs, "{GDISCORE}"_jrs);
this->GDISPMTag = config[configSection].get("GDISPMTag"_jrs, "{GDISPM}"_jrs);
this->GDIGameTimeTag = config[configSection].get("GDIGameTimeTag"_jrs, "{GDIGAMETIME}"_jrs);
this->GDITiesTag = config[configSection].get("GDITiesTag"_jrs, "{GDITIES}"_jrs);
this->GDIBeaconPlacementsTag = config[configSection].get("GDIBeaconPlacementsTag"_jrs, "{GDIBEACONPLACEMENTS}"_jrs);
this->GDIBeaconDisarmsTag = config[configSection].get("GDIBeaconDisarmsTag"_jrs, "{GDIBEACONDISARMS}"_jrs);
this->GDIProxyPlacementsTag = config[configSection].get("GDIProxyPlacementsTag"_jrs, "{GDIPROXYPLACEMENTS}"_jrs);
this->GDIProxyDisarmsTag = config[configSection].get("GDIProxyDisarmsTag"_jrs, "{GDIPROXYDISARMS}"_jrs);
this->GDIKillsTag = config[configSection].get("GDIKillsTag"_jrs, "{GDIKILLS}"_jrs);
this->GDIDeathsTag = config[configSection].get("GDIDeathsTag"_jrs, "{GDIDEATHS}"_jrs);
this->GDIVehicleKillsTag = config[configSection].get("GDIVehicleKillsTag"_jrs, "{GDIVEHICLEKILLS}"_jrs);
this->GDIDefenceKillsTag = config[configSection].get("GDIDefenceKillsTag"_jrs, "{GDIDEFENCEKILLS}"_jrs);
this->GDIBuildingKillsTag = config[configSection].get("GDIBuildingKillsTag"_jrs, "{GDIBUILDINGKILLS}"_jrs);
this->GDIKDRTag = config[configSection].get("GDIKDRTag"_jrs, "{GDIKDR}"_jrs);
this->GDIHeadshotsTag = config[configSection].get("GDIHeadshotsTag"_jrs, "{GDIHEADSHOTS}"_jrs);
this->GDIHeadshotKillRatioTag = config[configSection].get("GDIHeadshotKillRatioTag"_jrs, "{GDIHSKR}"_jrs);
this->NodScoreTag = config[configSection].get("NodScoreTag"_jrs, "{NODSCORE}"_jrs);
this->NodSPMTag = config[configSection].get("NodSPMTag"_jrs, "{NODSPM}"_jrs);
this->NodGameTimeTag = config[configSection].get("NodGameTimeTag"_jrs, "{NODGAMETIME}"_jrs);
this->NodTiesTag = config[configSection].get("NodTiesTag"_jrs, "{NODTIES}"_jrs);
this->NodBeaconPlacementsTag = config[configSection].get("NodBeaconPlacementsTag"_jrs, "{NODBEACONPLACEMENTS}"_jrs);
this->NodBeaconDisarmsTag = config[configSection].get("NodBeaconDisarmsTag"_jrs, "{NODBEACONDISARMS}"_jrs);
this->NodProxyPlacementsTag = config[configSection].get("NodProxyPlacementsTag"_jrs, "{NODPROXYPLACEMENTS}"_jrs);
this->NodProxyDisarmsTag = config[configSection].get("NodProxyDisarmsTag"_jrs, "{NODPROXYDISARMS}"_jrs);
this->NodKillsTag = config[configSection].get("NodKillsTag"_jrs, "{NODKILLS}"_jrs);
this->NodDeathsTag = config[configSection].get("NodDeathsTag"_jrs, "{NODDEATHS}"_jrs);
this->NodVehicleKillsTag = config[configSection].get("NodVehicleKillsTag"_jrs, "{NODVEHICLEKILLS}"_jrs);
this->NodDefenceKillsTag = config[configSection].get("NodDefenceKillsTag"_jrs, "{NODDEFENCEKILLS}"_jrs);
this->NodBuildingKillsTag = config[configSection].get("NodBuildingKillsTag"_jrs, "{NODBUILDINGKILLS}"_jrs);
this->NodKDRTag = config[configSection].get("NodKDRTag"_jrs, "{NODKDR}"_jrs);
this->NodHeadshotsTag = config[configSection].get("NodHeadshotsTag"_jrs, "{NODHEADSHOTS}"_jrs);
this->NodHeadshotKillRatioTag = config[configSection].get("NodHeadshotKillRatioTag"_jrs, "{NODHSKR}"_jrs);
this->rankTag = config[configSection].get("RankTag"sv, "{RANK}"sv);
this->lastGameTag = config[configSection].get("LastGameTag"sv, "{LASTGAME}"sv);
this->GDIScoreTag = config[configSection].get("GDIScoreTag"sv, "{GDISCORE}"sv);
this->GDISPMTag = config[configSection].get("GDISPMTag"sv, "{GDISPM}"sv);
this->GDIGameTimeTag = config[configSection].get("GDIGameTimeTag"sv, "{GDIGAMETIME}"sv);
this->GDITiesTag = config[configSection].get("GDITiesTag"sv, "{GDITIES}"sv);
this->GDIBeaconPlacementsTag = config[configSection].get("GDIBeaconPlacementsTag"sv, "{GDIBEACONPLACEMENTS}"sv);
this->GDIBeaconDisarmsTag = config[configSection].get("GDIBeaconDisarmsTag"sv, "{GDIBEACONDISARMS}"sv);
this->GDIProxyPlacementsTag = config[configSection].get("GDIProxyPlacementsTag"sv, "{GDIPROXYPLACEMENTS}"sv);
this->GDIProxyDisarmsTag = config[configSection].get("GDIProxyDisarmsTag"sv, "{GDIPROXYDISARMS}"sv);
this->GDIKillsTag = config[configSection].get("GDIKillsTag"sv, "{GDIKILLS}"sv);
this->GDIDeathsTag = config[configSection].get("GDIDeathsTag"sv, "{GDIDEATHS}"sv);
this->GDIVehicleKillsTag = config[configSection].get("GDIVehicleKillsTag"sv, "{GDIVEHICLEKILLS}"sv);
this->GDIDefenceKillsTag = config[configSection].get("GDIDefenceKillsTag"sv, "{GDIDEFENCEKILLS}"sv);
this->GDIBuildingKillsTag = config[configSection].get("GDIBuildingKillsTag"sv, "{GDIBUILDINGKILLS}"sv);
this->GDIKDRTag = config[configSection].get("GDIKDRTag"sv, "{GDIKDR}"sv);
this->GDIHeadshotsTag = config[configSection].get("GDIHeadshotsTag"sv, "{GDIHEADSHOTS}"sv);
this->GDIHeadshotKillRatioTag = config[configSection].get("GDIHeadshotKillRatioTag"sv, "{GDIHSKR}"sv);
this->NodScoreTag = config[configSection].get("NodScoreTag"sv, "{NODSCORE}"sv);
this->NodSPMTag = config[configSection].get("NodSPMTag"sv, "{NODSPM}"sv);
this->NodGameTimeTag = config[configSection].get("NodGameTimeTag"sv, "{NODGAMETIME}"sv);
this->NodTiesTag = config[configSection].get("NodTiesTag"sv, "{NODTIES}"sv);
this->NodBeaconPlacementsTag = config[configSection].get("NodBeaconPlacementsTag"sv, "{NODBEACONPLACEMENTS}"sv);
this->NodBeaconDisarmsTag = config[configSection].get("NodBeaconDisarmsTag"sv, "{NODBEACONDISARMS}"sv);
this->NodProxyPlacementsTag = config[configSection].get("NodProxyPlacementsTag"sv, "{NODPROXYPLACEMENTS}"sv);
this->NodProxyDisarmsTag = config[configSection].get("NodProxyDisarmsTag"sv, "{NODPROXYDISARMS}"sv);
this->NodKillsTag = config[configSection].get("NodKillsTag"sv, "{NODKILLS}"sv);
this->NodDeathsTag = config[configSection].get("NodDeathsTag"sv, "{NODDEATHS}"sv);
this->NodVehicleKillsTag = config[configSection].get("NodVehicleKillsTag"sv, "{NODVEHICLEKILLS}"sv);
this->NodDefenceKillsTag = config[configSection].get("NodDefenceKillsTag"sv, "{NODDEFENCEKILLS}"sv);
this->NodBuildingKillsTag = config[configSection].get("NodBuildingKillsTag"sv, "{NODBUILDINGKILLS}"sv);
this->NodKDRTag = config[configSection].get("NodKDRTag"sv, "{NODKDR}"sv);
this->NodHeadshotsTag = config[configSection].get("NodHeadshotsTag"sv, "{NODHEADSHOTS}"sv);
this->NodHeadshotKillRatioTag = config[configSection].get("NodHeadshotKillRatioTag"sv, "{NODHSKR}"sv);
/** Other tags */
this->weaponTag = config[configSection].get("WeaponTag"_jrs, "{WEAPON}"_jrs);
this->objectTag = config[configSection].get("ObjectTag"_jrs, "{OBJECT}"_jrs);
this->messageTag = config[configSection].get("MessageTag"_jrs, "{MESSAGE}"_jrs);
this->newNameTag = config[configSection].get("NewNameTag"_jrs, "{NNAME}"_jrs);
this->winScoreTag = config[configSection].get("WinScoreTag"_jrs, "{WINSCORE}"_jrs);
this->loseScoreTag = config[configSection].get("LoseScoreTag"_jrs, "{LOSESCORE}"_jrs);
this->weaponTag = config[configSection].get("WeaponTag"sv, "{WEAPON}"sv);
this->objectTag = config[configSection].get("ObjectTag"sv, "{OBJECT}"sv);
this->messageTag = config[configSection].get("MessageTag"sv, "{MESSAGE}"sv);
this->newNameTag = config[configSection].get("NewNameTag"sv, "{NNAME}"sv);
this->winScoreTag = config[configSection].get("WinScoreTag"sv, "{WINSCORE}"sv);
this->loseScoreTag = config[configSection].get("LoseScoreTag"sv, "{LOSESCORE}"sv);
return true;
}
@ -868,9 +867,8 @@ void TagsImp::sanitizeTags(std::string& fmt)
}
}
std::string_view TagsImp::getUniqueInternalTag()
{
this->uniqueTag.set(1, reinterpret_cast<const char *>(&this->tagItr), sizeof(TagsImp::tagItr));
std::string_view TagsImp::getUniqueInternalTag() {
std::memcpy(this->uniqueTag.data() + 1, reinterpret_cast<const char *>(&this->tagItr), sizeof(TagsImp::tagItr));
++TagsImp::tagItr;
return this->uniqueTag;
}

1
src/Plugins/RenX/RenX.Core/RenX_Tags.h

@ -24,7 +24,6 @@
* @brief Provides tag processing functions
*/
#include "Jupiter/String.hpp"
#include "RenX.h"
#include "RenX_LadderDatabase.h"

3
src/Plugins/RenX/RenX.Core/RenX_TeamInfo.h

@ -24,7 +24,6 @@
* @brief Defines the BuildingInfo structure.
*/
#include "Jupiter/String.hpp"
#include "RenX.h"
/** DLL Linkage Nagging */
@ -49,7 +48,7 @@ namespace RenX
int32_t mine_limit;
int32_t vehicle_count;
int32_t vehicle_limit;
Jupiter::StringS name;
std::string name;
};
}

13
src/Plugins/RenX/RenX.ExcessiveHeadshots/RenX_ExcessiveHeadshots.cpp

@ -23,15 +23,14 @@
#include "RenX_PlayerInfo.h"
#include "RenX_Functions.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_ExcessiveHeadshotsPlugin::initialize() {
RenX_ExcessiveHeadshotsPlugin::ratio = this->config.get<double>("HeadshotKillRatio"_jrs, 0.5);
RenX_ExcessiveHeadshotsPlugin::minKills = this->config.get<unsigned int>("Kills"_jrs, 10);
RenX_ExcessiveHeadshotsPlugin::minKD = this->config.get<double>("KillDeathRatio"_jrs, 5.0);
RenX_ExcessiveHeadshotsPlugin::minKPS = this->config.get<double>("KillsPerSecond"_jrs, 0.5);
RenX_ExcessiveHeadshotsPlugin::minFlags = this->config.get<unsigned int>("Flags"_jrs, 4);
RenX_ExcessiveHeadshotsPlugin::ratio = this->config.get<double>("HeadshotKillRatio"sv, 0.5);
RenX_ExcessiveHeadshotsPlugin::minKills = this->config.get<unsigned int>("Kills"sv, 10);
RenX_ExcessiveHeadshotsPlugin::minKD = this->config.get<double>("KillDeathRatio"sv, 5.0);
RenX_ExcessiveHeadshotsPlugin::minKPS = this->config.get<double>("KillsPerSecond"sv, 0.5);
RenX_ExcessiveHeadshotsPlugin::minFlags = this->config.get<unsigned int>("Flags"sv, 4);
return true;
}
@ -57,7 +56,7 @@ void RenX_ExcessiveHeadshotsPlugin::RenX_OnKill(RenX::Server &server, const RenX
if (flags >= RenX_ExcessiveHeadshotsPlugin::minFlags)
{
server.banPlayer(player, "Jupiter Bot"_jrs, "Aimbot detected"_jrs);
server.banPlayer(player, "Jupiter Bot"sv, "Aimbot detected"sv);
server.sendPubChan(IRCCOLOR "13[Aimbot]" IRCCOLOR " %.*s was banned from the server! Kills: %u - Deaths: %u - Headshots: %u", player.name.size(), player.name.data(), player.kills, player.deaths, player.headshots);
std::string_view 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.data(), player.kills, player.deaths, player.headshots, player.ip.size(), player.ip.data(), steamid.size(),

12
src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.cpp

@ -21,7 +21,7 @@
#include "RenX_Server.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin()
{
@ -46,15 +46,15 @@ int RenX_ExtraLoggingPlugin::OnRehash()
}
bool RenX_ExtraLoggingPlugin::initialize() {
RenX_ExtraLoggingPlugin::filePrefix = this->config.get("FilePrefix"_jrs, string_printf("[%.*s] %.*s", RenX::tags->timeTag.size(),
RenX_ExtraLoggingPlugin::filePrefix = this->config.get("FilePrefix"sv, string_printf("[%.*s] %.*s", RenX::tags->timeTag.size(),
RenX::tags->timeTag.data(), RenX::tags->serverPrefixTag.size(),
RenX::tags->serverPrefixTag.data()));
RenX_ExtraLoggingPlugin::consolePrefix = this->config.get("ConsolePrefix"_jrs, RenX_ExtraLoggingPlugin::filePrefix);
RenX_ExtraLoggingPlugin::newDayFmt = this->config.get("NewDayFormat"_jrs, string_printf("Time: %.*s %.*s", RenX::tags->timeTag.size(),
RenX_ExtraLoggingPlugin::consolePrefix = this->config.get("ConsolePrefix"sv, RenX_ExtraLoggingPlugin::filePrefix);
RenX_ExtraLoggingPlugin::newDayFmt = this->config.get("NewDayFormat"sv, string_printf("Time: %.*s %.*s", RenX::tags->timeTag.size(),
RenX::tags->timeTag.data(), RenX::tags->dateTag.size(),
RenX::tags->dateTag.data()));
RenX_ExtraLoggingPlugin::printToConsole = this->config.get<bool>("PrintToConsole"_jrs, true);
const std::string logFile = static_cast<std::string>(this->config.get("LogFile"_jrs));
RenX_ExtraLoggingPlugin::printToConsole = this->config.get<bool>("PrintToConsole"sv, true);
const std::string logFile = static_cast<std::string>(this->config.get("LogFile"sv));
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::filePrefix);
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::consolePrefix);

1
src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.h

@ -20,7 +20,6 @@
#define _RENX_EXTRALOGGING_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/String.hpp"
#include "RenX_Plugin.h"
class RenX_ExtraLoggingPlugin : public RenX::Plugin

1
src/Plugins/RenX/RenX.Greetings/RenX_Greetings.cpp

@ -22,7 +22,6 @@
#include "RenX_Server.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
void RenX_GreetingsPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) {

2
src/Plugins/RenX/RenX.Greetings/RenX_Greetings.h

@ -20,9 +20,7 @@
#define _RENX_GREETING_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/File.h"
#include "Jupiter/String.hpp"
#include "RenX_Plugin.h"
class RenX_GreetingsPlugin : public RenX::Plugin

4
src/Plugins/RenX/RenX.HybridUUID/RenX_HybridUUID.cpp

@ -16,17 +16,15 @@
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include "Jupiter/String.hpp"
#include "RenX_Core.h"
#include "RenX_Server.h"
#include "RenX_PlayerInfo.h"
#include "RenX_Functions.h"
#include "RenX_HybridUUID.h"
using namespace Jupiter::literals;
using namespace std::literals;
Jupiter::StringS calc_uuid(RenX::PlayerInfo &player)
std::string calc_uuid(RenX::PlayerInfo &player)
{
if (player.steamid != 0U)
return string_printf("S%.16llX", player.steamid);

1
src/Plugins/RenX/RenX.HybridUUID/RenX_HybridUUID.h

@ -20,7 +20,6 @@
#define _RENX_HYBRIDUUID_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_HybridUUIDPlugin : public RenX::Plugin

82
src/Plugins/RenX/RenX.IRCJoin/RenX_IRCJoin.cpp

@ -17,88 +17,82 @@
*/
#include "Jupiter/IRC_Client.h"
#include "Jupiter/String.hpp"
#include "RenX_Core.h"
#include "RenX_Server.h"
#include "RenX_IRCJoin.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_IRCJoinPlugin::initialize()
{
RenX_IRCJoinPlugin::publicOnly = this->config.get<bool>("PublicOnly"_jrs, true);
RenX_IRCJoinPlugin::joinMsgAlways = this->config.get<bool>("Join.MsgAlways"_jrs, false);
RenX_IRCJoinPlugin::partMsgAlways = this->config.get<bool>("Part.MsgAlways"_jrs, false);
RenX_IRCJoinPlugin::minAccessPartMessage = this->config.get<int>("Part.MinAccess"_jrs, 0);
RenX_IRCJoinPlugin::maxAccessPartMessage = this->config.get<int>("Part.MaxAccess"_jrs, -1);
RenX_IRCJoinPlugin::nameTag = this->config.get("NameTag"_jrs, "{NAME}"_jrs);
RenX_IRCJoinPlugin::chanTag = this->config.get("ChannelTag"_jrs, "{CHAN}"_jrs);
RenX_IRCJoinPlugin::partReasonTag = this->config.get("PartReasonTag"_jrs, "{REASON}"_jrs);
RenX_IRCJoinPlugin::joinFmt = this->config.get("Join.Format"_jrs, "{NAME} has joined {CHAN}!"_jrs);
RenX_IRCJoinPlugin::partFmt = this->config.get("Part.Format"_jrs, "{NAME} has left {CHAN} ({REASON})!"_jrs);
RenX_IRCJoinPlugin::partFmtNoReason = this->config.get("Part.FormatNoReason"_jrs, "{NAME} has left {CHAN}!"_jrs);
bool RenX_IRCJoinPlugin::initialize() {
RenX_IRCJoinPlugin::publicOnly = this->config.get<bool>("PublicOnly"sv, true);
RenX_IRCJoinPlugin::joinMsgAlways = this->config.get<bool>("Join.MsgAlways"sv, false);
RenX_IRCJoinPlugin::partMsgAlways = this->config.get<bool>("Part.MsgAlways"sv, false);
RenX_IRCJoinPlugin::minAccessPartMessage = this->config.get<int>("Part.MinAccess"sv, 0);
RenX_IRCJoinPlugin::maxAccessPartMessage = this->config.get<int>("Part.MaxAccess"sv, -1);
RenX_IRCJoinPlugin::nameTag = this->config.get("NameTag"sv, "{NAME}"sv);
RenX_IRCJoinPlugin::chanTag = this->config.get("ChannelTag"sv, "{CHAN}"sv);
RenX_IRCJoinPlugin::partReasonTag = this->config.get("PartReasonTag"sv, "{REASON}"sv);
RenX_IRCJoinPlugin::joinFmt = this->config.get("Join.Format"sv, "{NAME} has joined {CHAN}!"sv);
RenX_IRCJoinPlugin::partFmt = this->config.get("Part.Format"sv, "{NAME} has left {CHAN} ({REASON})!"sv);
RenX_IRCJoinPlugin::partFmtNoReason = this->config.get("Part.FormatNoReason"sv, "{NAME} has left {CHAN}!"sv);
return true;
}
void RenX_IRCJoinPlugin::OnJoin(Jupiter::IRC::Client *source, std::string_view channel, std::string_view nick)
{
if (!RenX_IRCJoinPlugin::joinFmt.empty())
{
void RenX_IRCJoinPlugin::OnJoin(Jupiter::IRC::Client *source, std::string_view channel, std::string_view nick) {
if (!RenX_IRCJoinPlugin::joinFmt.empty()) {
RenX::Server *server;
int type = source->getChannel(channel)->getType();
Jupiter::String msg = RenX_IRCJoinPlugin::joinFmt;
msg.replace(RenX_IRCJoinPlugin::nameTag, nick);
msg.replace(RenX_IRCJoinPlugin::chanTag, channel);
std::string msg = RenX_IRCJoinPlugin::joinFmt;
RenX::replace_tag(msg, RenX_IRCJoinPlugin::nameTag, nick);
RenX::replace_tag(msg, RenX_IRCJoinPlugin::chanTag, channel);
auto checkType = [&]
{
auto checkType = [&] {
if (this->publicOnly)
return server->isPublicLogChanType(type);
else
return server->isLogChanType(type);
};
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) {
server = RenX::getCore()->getServer(i);
if (checkType() && (RenX_IRCJoinPlugin::joinMsgAlways || server->players.size() != server->getBotCount()))
if (checkType() && (RenX_IRCJoinPlugin::joinMsgAlways || server->players.size() != server->getBotCount())) {
server->sendMessage(msg);
}
}
}
}
void RenX_IRCJoinPlugin::OnPart(Jupiter::IRC::Client *source, std::string_view channel, std::string_view nick, std::string_view reason)
{
if (!RenX_IRCJoinPlugin::partFmt.empty())
{
void RenX_IRCJoinPlugin::OnPart(Jupiter::IRC::Client *source, std::string_view channel, std::string_view nick, std::string_view reason) {
if (!RenX_IRCJoinPlugin::partFmt.empty()) {
int access = source->getAccessLevel(channel, nick);
if (access >= RenX_IRCJoinPlugin::minAccessPartMessage && (RenX_IRCJoinPlugin::maxAccessPartMessage == -1 || access <= RenX_IRCJoinPlugin::maxAccessPartMessage))
{
if (access >= RenX_IRCJoinPlugin::minAccessPartMessage && (RenX_IRCJoinPlugin::maxAccessPartMessage == -1 || access <= RenX_IRCJoinPlugin::maxAccessPartMessage)) {
RenX::Server *server;
int type = source->getChannel(channel)->getType();
Jupiter::String msg;
std::string msg;
if (reason.empty())
msg = RenX_IRCJoinPlugin::partFmtNoReason;
else
msg = RenX_IRCJoinPlugin::partFmt;
msg.replace(RenX_IRCJoinPlugin::nameTag, nick);
msg.replace(RenX_IRCJoinPlugin::chanTag, channel);
msg.replace(RenX_IRCJoinPlugin::partReasonTag, reason);
RenX::replace_tag(msg, RenX_IRCJoinPlugin::nameTag, nick);
RenX::replace_tag(msg, RenX_IRCJoinPlugin::chanTag, channel);
RenX::replace_tag(msg, RenX_IRCJoinPlugin::partReasonTag, reason);
auto checkType = [&]()
{
if (this->publicOnly)
auto checkType = [&]() {
if (this->publicOnly) {
return server->isPublicLogChanType(type);
else
}
else {
return server->isLogChanType(type);
}
};
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) {
server = RenX::getCore()->getServer(i);
if (checkType() && (RenX_IRCJoinPlugin::partMsgAlways || server->players.size() != server->getBotCount()))
if (checkType() && (RenX_IRCJoinPlugin::partMsgAlways || server->players.size() != server->getBotCount())) {
server->sendMessage(msg);
}
}
}
}

13
src/Plugins/RenX/RenX.IRCJoin/RenX_IRCJoin.h

@ -20,7 +20,6 @@
#define _RENX_IRCJOIN_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_IRCJoinPlugin : public RenX::Plugin
@ -38,12 +37,12 @@ private:
bool partMsgAlways;
int minAccessPartMessage;
int maxAccessPartMessage;
Jupiter::StringS nameTag;
Jupiter::StringS chanTag;
Jupiter::StringS partReasonTag;
Jupiter::StringS joinFmt;
Jupiter::StringS partFmt;
Jupiter::StringS partFmtNoReason;
std::string nameTag;
std::string chanTag;
std::string partReasonTag;
std::string joinFmt;
std::string partFmt;
std::string partFmtNoReason;
};
#endif // _RENX_IRCJOIN_H_HEADER

3
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp

@ -23,7 +23,6 @@
#include "RenX_PlayerInfo.h"
#include "RenX_KickDupes.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_KickDupesPlugin::initialize() {
@ -48,7 +47,7 @@ void RenX_KickDupesPlugin::RenX_OnPlayerIdentify(RenX::Server &in_server, const
if (player.hwid == in_player.hwid && player.id != in_player.id) {
// Two players have the same HWID, but separate player IDs; kick the pre-existing player if there's too many.
if (++hits > s_tolerance) {
in_server.forceKickPlayer(player, "Ghost client detected"_jrs);
in_server.forceKickPlayer(player, "Ghost client detected"sv);
}
}
}

1
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h

@ -20,7 +20,6 @@
#define _RENX_KICKDUPES_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_KickDupesPlugin : public RenX::Plugin

17
src/Plugins/RenX/RenX.Ladder.All-Time/RenX_Ladder_All_Time.cpp

@ -19,18 +19,18 @@
#include "Jupiter/IRC_Client.h"
#include "RenX_Ladder_All_Time.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_Ladder_All_TimePlugin::initialize()
{
bool RenX_Ladder_All_TimePlugin::initialize() {
// Load database
this->database.process_file(this->config.get("LadderDatabase"_jrs, "Ladder.db"_jrs));
this->database.setName(this->config.get("DatabaseName"_jrs, "All-Time"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, true));
this->database.process_file(this->config.get("LadderDatabase"sv, "Ladder.db"sv));
this->database.setName(this->config.get("DatabaseName"sv, "All-Time"sv));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"sv, true));
// Force database to default, if desired
if (this->config.get<bool>("ForceDefault"_jrs, true))
if (this->config.get<bool>("ForceDefault"sv, true)) {
RenX::default_ladder_database = &this->database;
}
return true;
}
@ -38,7 +38,6 @@ bool RenX_Ladder_All_TimePlugin::initialize()
// Plugin instantiation and entry point.
RenX_Ladder_All_TimePlugin pluginInstance;
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

1
src/Plugins/RenX/RenX.Ladder.All-Time/RenX_Ladder_All_Time.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_ALL_TIME
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

23
src/Plugins/RenX/RenX.Ladder.Daily/RenX_Ladder_Daily.cpp

@ -20,22 +20,22 @@
#include "Jupiter/IRC_Client.h"
#include "RenX_Ladder_Daily.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_Ladder_Daily_TimePlugin::initialize()
{
bool RenX_Ladder_Daily_TimePlugin::initialize() {
time_t current_time = time(0);
// Load database
this->database.process_file(this->config.get("LadderDatabase"_jrs, "Ladder.Daily.db"_jrs));
this->database.setName(this->config.get("DatabaseName"_jrs, "Daily"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->database.process_file(this->config.get("LadderDatabase"sv, "Ladder.Daily.db"sv));
this->database.setName(this->config.get("DatabaseName"sv, "Daily"sv));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"sv, false));
this->last_sorted_day = gmtime(&current_time)->tm_wday;
this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired
if (this->config.get<bool>("ForceDefault"_jrs, false))
if (this->config.get<bool>("ForceDefault"sv, false)) {
RenX::default_ladder_database = &this->database;
}
return true;
}
@ -43,16 +43,15 @@ bool RenX_Ladder_Daily_TimePlugin::initialize()
// Plugin instantiation and entry point.
RenX_Ladder_Daily_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) {
time_t current_time = time(0);
tm *tm_ptr = gmtime(&current_time);
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday)
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday) {
database.erase();
}
pluginInstance.last_sorted_day = tm_ptr->tm_wday;
}
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

1
src/Plugins/RenX/RenX.Ladder.Daily/RenX_Ladder_Daily.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_ALL_TIME
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

20
src/Plugins/RenX/RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp

@ -20,22 +20,22 @@
#include "Jupiter/IRC_Client.h"
#include "RenX_Ladder_Monthly.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_Ladder_Monthly_TimePlugin::initialize()
{
bool RenX_Ladder_Monthly_TimePlugin::initialize() {
time_t current_time = time(0);
// Load database
this->database.process_file(this->config.get("LadderDatabase"_jrs, "Ladder.Monthly.db"_jrs));
this->database.setName(this->config.get("DatabaseName"_jrs, "Monthly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->database.process_file(this->config.get("LadderDatabase"sv, "Ladder.Monthly.db"sv));
this->database.setName(this->config.get("DatabaseName"sv, "Monthly"sv));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"sv, false));
this->last_sorted_month = gmtime(&current_time)->tm_mon;
this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired
if (this->config.get<bool>("ForceDefault"_jrs, false))
if (this->config.get<bool>("ForceDefault"sv, false)) {
RenX::default_ladder_database = &this->database;
}
return true;
}
@ -43,12 +43,12 @@ bool RenX_Ladder_Monthly_TimePlugin::initialize()
// Plugin instantiation and entry point.
RenX_Ladder_Monthly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) {
time_t current_time = time(0);
tm *tm_ptr = gmtime(&current_time);
if (pluginInstance.last_sorted_month != tm_ptr->tm_mon)
if (pluginInstance.last_sorted_month != tm_ptr->tm_mon) {
database.erase();
}
pluginInstance.last_sorted_month = tm_ptr->tm_mon;
}

1
src/Plugins/RenX/RenX.Ladder.Monthly/RenX_Ladder_Monthly.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_ALL_TIME
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

104
src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.cpp

@ -25,14 +25,13 @@
#include "RenX_Ladder_Web.h"
using namespace std::literals;
using namespace Jupiter::literals;
bool RenX_Ladder_WebPlugin::initialize() {
RenX_Ladder_WebPlugin::ladder_page_name = this->config.get("LadderPageName"_jrs, ""_jrs);
RenX_Ladder_WebPlugin::search_page_name = this->config.get("SearchPageName"_jrs, "search"_jrs);
RenX_Ladder_WebPlugin::profile_page_name = this->config.get("ProfilePageName"_jrs, "profile"_jrs);
RenX_Ladder_WebPlugin::web_hostname = this->config.get("Hostname"_jrs, ""_jrs);
RenX_Ladder_WebPlugin::web_path = this->config.get("Path"_jrs, "/"_jrs);
RenX_Ladder_WebPlugin::ladder_page_name = this->config.get("LadderPageName"sv, ""sv);
RenX_Ladder_WebPlugin::search_page_name = this->config.get("SearchPageName"sv, "search"sv);
RenX_Ladder_WebPlugin::profile_page_name = this->config.get("ProfilePageName"sv, "profile"sv);
RenX_Ladder_WebPlugin::web_hostname = this->config.get("Hostname"sv, ""sv);
RenX_Ladder_WebPlugin::web_path = this->config.get("Path"sv, "/"sv);
this->init();
@ -71,17 +70,17 @@ void RenX_Ladder_WebPlugin::init() {
FILE *file;
int chr;
RenX_Ladder_WebPlugin::web_header_filename = static_cast<std::string>(this->config.get("HeaderFilename"_jrs, "RenX.Ladder.Web.Header.html"_jrs));
RenX_Ladder_WebPlugin::web_footer_filename = static_cast<std::string>(this->config.get("FooterFilename"_jrs, "RenX.Ladder.Web.Footer.html"_jrs));
RenX_Ladder_WebPlugin::web_profile_filename = static_cast<std::string>(this->config.get("ProfileFilename"_jrs, "RenX.Ladder.Web.Profile.html"_jrs));
RenX_Ladder_WebPlugin::web_ladder_table_header_filename = static_cast<std::string>(this->config.get("LadderTableHeaderFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Header.html"_jrs));
RenX_Ladder_WebPlugin::web_ladder_table_footer_filename = static_cast<std::string>(this->config.get("LadderTableFooterFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Footer.html"_jrs));
RenX_Ladder_WebPlugin::entries_per_page = this->config.get<size_t>("EntriesPerPage"_jrs, 50);
RenX_Ladder_WebPlugin::min_search_name_length = this->config.get<size_t>("MinSearchNameLength"_jrs, 3);
RenX_Ladder_WebPlugin::web_header_filename = static_cast<std::string>(this->config.get("HeaderFilename"sv, "RenX.Ladder.Web.Header.html"sv));
RenX_Ladder_WebPlugin::web_footer_filename = static_cast<std::string>(this->config.get("FooterFilename"sv, "RenX.Ladder.Web.Footer.html"sv));
RenX_Ladder_WebPlugin::web_profile_filename = static_cast<std::string>(this->config.get("ProfileFilename"sv, "RenX.Ladder.Web.Profile.html"sv));
RenX_Ladder_WebPlugin::web_ladder_table_header_filename = static_cast<std::string>(this->config.get("LadderTableHeaderFilename"sv, "RenX.Ladder.Web.Ladder.Table.Header.html"sv));
RenX_Ladder_WebPlugin::web_ladder_table_footer_filename = static_cast<std::string>(this->config.get("LadderTableFooterFilename"sv, "RenX.Ladder.Web.Ladder.Table.Footer.html"sv));
RenX_Ladder_WebPlugin::entries_per_page = this->config.get<size_t>("EntriesPerPage"sv, 50);
RenX_Ladder_WebPlugin::min_search_name_length = this->config.get<size_t>("MinSearchNameLength"sv, 3);
RenX_Ladder_WebPlugin::entry_table_row = this->config.get("EntryTableRow"_jrs, R"html(<tr><td class="data-col-a">{RANK}</td><td class="data-col-b"><a href="profile?id={STEAM}&database={OBJECT}">{NAME}</a></td><td class="data-col-a">{SCORE}</td><td class="data-col-b">{SPM}</td><td class="data-col-a">{GAMES}</td><td class="data-col-b">{WINS}</td><td class="data-col-a">{LOSSES}</td><td class="data-col-b">{WLR}</td><td class="data-col-a">{KILLS}</td><td class="data-col-b">{DEATHS}</td><td class="data-col-a">{KDR}</td></tr>)html"_jrs);
RenX_Ladder_WebPlugin::entry_profile_previous = this->config.get("EntryProfilePrevious"_jrs, R"html(<form class="profile-previous"><input type="hidden" name="database" value="{OBJECT}"/><input type="hidden" name="id" value="{WEAPON}"/><input class="profile-previous-submit" type="submit" value="&#x21A9 Previous" /></form>)html"_jrs);
RenX_Ladder_WebPlugin::entry_profile_next = this->config.get("EntryProfileNext"_jrs, R"html(<form class="profile-next"><input type="hidden" name="database" value="{OBJECT}"/><input type="hidden" name="id" value="{VSTEAM}"/><input class="profile-next-submit" type="submit" value="Next &#x21AA" /></form>)html"_jrs);
RenX_Ladder_WebPlugin::entry_table_row = this->config.get("EntryTableRow"sv, R"html(<tr><td class="data-col-a">{RANK}</td><td class="data-col-b"><a href="profile?id={STEAM}&database={OBJECT}">{NAME}</a></td><td class="data-col-a">{SCORE}</td><td class="data-col-b">{SPM}</td><td class="data-col-a">{GAMES}</td><td class="data-col-b">{WINS}</td><td class="data-col-a">{LOSSES}</td><td class="data-col-b">{WLR}</td><td class="data-col-a">{KILLS}</td><td class="data-col-b">{DEATHS}</td><td class="data-col-a">{KDR}</td></tr>)html"sv);
RenX_Ladder_WebPlugin::entry_profile_previous = this->config.get("EntryProfilePrevious"sv, R"html(<form class="profile-previous"><input type="hidden" name="database" value="{OBJECT}"/><input type="hidden" name="id" value="{WEAPON}"/><input class="profile-previous-submit" type="submit" value="&#x21A9 Previous" /></form>)html"sv);
RenX_Ladder_WebPlugin::entry_profile_next = this->config.get("EntryProfileNext"sv, R"html(<form class="profile-next"><input type="hidden" name="database" value="{OBJECT}"/><input type="hidden" name="id" value="{VSTEAM}"/><input class="profile-next-submit" type="submit" value="Next &#x21AA" /></form>)html"sv);
RenX::sanitizeTags(RenX_Ladder_WebPlugin::entry_table_row);
RenX::sanitizeTags(RenX_Ladder_WebPlugin::entry_profile_previous);
@ -155,30 +154,30 @@ int RenX_Ladder_WebPlugin::OnRehash() {
RenX_Ladder_WebPlugin pluginInstance;
/** Search bar */
Jupiter::String generate_search(RenX::LadderDatabase *db) {
std::string generate_search(RenX::LadderDatabase *db) {
std::string result;
result = R"database-search(<form action="search" method="get" class="leaderboard-search"><input type="text" class="leaderboard-search-input" name="name" size="30" placeholder="Player name" value=""/>)database-search"_jrs;
result = R"database-search(<form action="search" method="get" class="leaderboard-search"><input type="text" class="leaderboard-search-input" name="name" size="30" placeholder="Player name" value=""/>)database-search"sv;
if (db != nullptr && db != RenX::default_ladder_database) {
result += R"database-search(<input type="hidden" name="database" value=")database-search"_jrs;
result += R"database-search(<input type="hidden" name="database" value=")database-search"sv;
result += db->getName();
result += R"database-search("/>)database-search"_jrs;
result += R"database-search("/>)database-search"sv;
}
result += R"database-search(<input type="submit" class="leaderboard-button" value="Search"/></form>)database-search"_jrs;
result += R"database-search(<input type="submit" class="leaderboard-button" value="Search"/></form>)database-search"sv;
return result;
}
/** Database selector */
Jupiter::String generate_database_selector(RenX::LadderDatabase *db, const Jupiter::HTTP::HTMLFormResponse& query_params) {
std::string generate_database_selector(RenX::LadderDatabase *db, const Jupiter::HTTP::HTMLFormResponse& query_params) {
std::string result;
result = R"database-select(<form method="get" class="database-select-form"><select name="database" class="database-select">)database-select"_jrs;
result = R"database-select(<form method="get" class="database-select-form"><select name="database" class="database-select">)database-select"sv;
if (db != nullptr) {
result += "<option value=\""_jrs;
result += "<option value=\""sv;
result += db->getName();
result += "\">"_jrs;
result += "\">"sv;
result += db->getName();
result += "</option>"_jrs;
result += "</option>"sv;
}
else if (RenX::ladder_databases.size() == 0) {
return {};
@ -186,64 +185,64 @@ Jupiter::String generate_database_selector(RenX::LadderDatabase *db, const Jupit
for (const auto& database : RenX::ladder_databases) {
if (database != db) {
result += "<option value=\""_jrs;
result += "<option value=\""sv;
result += database->getName();
result += "\">"_jrs;
result += "\">"sv;
result += database->getName();
result += "</option>"_jrs;
result += "</option>"sv;
}
}
auto value = query_params.tableFind("id"sv);
if (value != query_params.table.end()) {
result += R"html(<input type="hidden" name="id" value=")html"_jrs;
result += R"html(<input type="hidden" name="id" value=")html"sv;
result += value->second;
result += R"html("/>)html"_jrs;
result += R"html("/>)html"sv;
}
result += R"database-select(</select><input type="submit" class="leaderboard-button" value="Go"/></form>)database-select"_jrs;
result += R"database-select(</select><input type="submit" class="leaderboard-button" value="Go"/></form>)database-select"sv;
return result;
}
/** Page buttons */
Jupiter::String generate_page_buttons(RenX::LadderDatabase *db) {
std::string generate_page_buttons(RenX::LadderDatabase *db) {
std::string result;
size_t entry_count = db->getEntries();
size_t entries_per_page = pluginInstance.getEntriesPerPage();
result = R"html(<div id="leaderboard-paging">)html"_jrs;
result = R"html(<div id="leaderboard-paging">)html"sv;
size_t entry_index = 0, page_index = 1;
while (entry_index < entry_count) {
// Add page
result += R"html(<span class="leaderboard-page"><a href="?start=)html"_jrs;
result += R"html(<span class="leaderboard-page"><a href="?start=)html"sv;
result += string_printf("%u", entry_index);
if (db != RenX::default_ladder_database) {
result += "&database="_jrs;
result += "&database="sv;
result += db->getName();
}
result += R"html(">)html"_jrs;
result += R"html(">)html"sv;
result += string_printf("%u", page_index);
result += R"html(</a></span>)html"_jrs;
result += R"html(</a></span>)html"sv;
// Increment indexes
entry_index += entries_per_page;
++page_index;
}
result += R"html(</div>)html"_jrs;
result += R"html(</div>)html"sv;
return result;
}
/** Ladder page */
Jupiter::String RenX_Ladder_WebPlugin::generate_entry_table(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count) {
std::string RenX_Ladder_WebPlugin::generate_entry_table(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count) {
if (db->getEntries() == 0) { // No ladder data
return Jupiter::String("Error: No ladder data"_jrs);
return std::string("Error: No ladder data"sv);
}
if (index >= db->getEntries() || count == 0) { // Invalid entry range
return Jupiter::String("Error: Invalid range"_jrs);
return std::string("Error: Invalid range"sv);
}
if (index + count > db->getEntries()) { // Invalid entry range; use valid portion of range
@ -259,7 +258,8 @@ Jupiter::String RenX_Ladder_WebPlugin::generate_entry_table(RenX::LadderDatabase
}
// table header
Jupiter::String result(2048);
std::string result;
result.reserve(ladder_table_header.size() + ladder_table_footer.size() + (count * entry_table_row.size()) + 256);
if ((format & this->FLAG_INCLUDE_DATA_HEADER) != 0) { // Data Header
result = RenX_Ladder_WebPlugin::ladder_table_header;
@ -326,7 +326,7 @@ std::string* RenX_Ladder_WebPlugin::generate_search_page(RenX::LadderDatabase *d
result->append(generate_database_selector(db, query_params));
if (db->getEntries() == 0) { // No ladder data
result->append("Error: No ladder data"_jrs);
result->append("Error: No ladder data"sv);
if ((format & this->FLAG_INCLUDE_PAGE_FOOTER) != 0) // Footer
result->append(RenX_Ladder_WebPlugin::footer);
@ -375,7 +375,7 @@ std::string* RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDatabase *
result->append(generate_database_selector(db, query_params));
if (db->getEntries() == 0) { // No ladder data
result->append("Error: No ladder data"_jrs);
result->append("Error: No ladder data"sv);
if ((format & this->FLAG_INCLUDE_PAGE_FOOTER) != 0) // Footer
result->append(RenX_Ladder_WebPlugin::footer);
@ -391,14 +391,14 @@ std::string* RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDatabase *
}
if (entry == nullptr) {
result->append("Error: Player not found"_jrs);
result->append("Error: Player not found"sv);
}
else {
std::string profile_data(RenX_Ladder_WebPlugin::entry_profile);
RenX::processTags(profile_data, *entry);
result->append(profile_data);
result->append("<div class=\"profile-navigation\">"_jrs);
result->append("<div class=\"profile-navigation\">"sv);
if (entry->prev != nullptr)
{
profile_data = RenX_Ladder_WebPlugin::entry_profile_previous;
@ -415,7 +415,7 @@ std::string* RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDatabase *
RenX::processTags(profile_data, *entry->next);
result->append(profile_data);
}
result->append("</div>"_jrs);
result->append("</div>"sv);
}
if ((format & this->FLAG_INCLUDE_PAGE_FOOTER) != 0) // Footer
@ -431,10 +431,10 @@ std::string* generate_no_db_page(const Jupiter::HTTP::HTMLFormResponse& query_pa
if (RenX::ladder_databases.size() != 0) {
result->append(generate_search(nullptr));
result->append(generate_database_selector(nullptr, query_params));
result->append("Error: No such database exists"_jrs);
result->append("Error: No such database exists"sv);
}
else {
result->append("Error: No ladder databases loaded"_jrs);
result->append("Error: No ladder databases loaded"sv);
}
result->append(pluginInstance.footer);
return result;
@ -511,8 +511,8 @@ std::string* handle_profile_page(std::string_view query_string) {
if (html_form_response.table.size() != 0)
{
format = html_form_response.tableGetCast<uint8_t>("format"_jrs, format);
steam_id = html_form_response.tableGetCast<uint64_t>("id"_jrs, steam_id);
format = html_form_response.tableGetCast<uint8_t>("format"sv, format);
steam_id = html_form_response.tableGetCast<uint64_t>("id"sv, steam_id);
std::string_view db_name = html_form_response.tableGet("database"sv, {});
if (!db_name.empty()) {

8
src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.h

@ -20,14 +20,12 @@
#define _RENX_LADDER_WEB_H
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/String.hpp"
#include "RenX_Plugin.h"
class RenX_Ladder_WebPlugin : public RenX::Plugin
{
protected:
Jupiter::String generate_entry_table(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count);
std::string generate_entry_table(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count);
public:
const uint8_t FLAG_INCLUDE_PAGE_HEADER = 0x01;
@ -37,8 +35,8 @@ public:
const uint8_t FLAG_INCLUDE_SEARCH = 0x10;
const uint8_t FLAG_INCLUDE_SELECTOR = 0x20;
Jupiter::StringS header;
Jupiter::StringS footer;
std::string header;
std::string footer;
std::string* generate_ladder_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::HTTP::HTMLFormResponse& query_params);
std::string* generate_search_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, std::string_view name, const Jupiter::HTTP::HTMLFormResponse& query_params);
std::string* generate_profile_page(RenX::LadderDatabase *db, uint8_t format, uint64_t steam_id, const Jupiter::HTTP::HTMLFormResponse& query_params);

26
src/Plugins/RenX/RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp

@ -20,23 +20,23 @@
#include "Jupiter/IRC_Client.h"
#include "RenX_Ladder_Weekly.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_Ladder_Weekly_TimePlugin::initialize()
{
bool RenX_Ladder_Weekly_TimePlugin::initialize() {
time_t current_time = time(0);
// Load database
this->database.process_file(this->config.get("LadderDatabase"_jrs, "Ladder.Weekly.db"_jrs));
this->database.setName(this->config.get("DatabaseName"_jrs, "Weekly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->database.process_file(this->config.get("LadderDatabase"sv, "Ladder.Weekly.db"sv));
this->database.setName(this->config.get("DatabaseName"sv, "Weekly"sv));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"sv, false));
this->last_sorted_day = gmtime(&current_time)->tm_wday;
this->reset_day = this->config.get<int>("ResetDay"_jrs);
this->reset_day = this->config.get<int>("ResetDay"sv);
this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired
if (this->config.get<bool>("ForceDefault"_jrs, false))
if (this->config.get<bool>("ForceDefault"sv, false)) {
RenX::default_ladder_database = &this->database;
}
return true;
}
@ -44,16 +44,16 @@ bool RenX_Ladder_Weekly_TimePlugin::initialize()
// Plugin instantiation and entry point.
RenX_Ladder_Weekly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) {
time_t current_time = time(0);
tm *tm_ptr = gmtime(&current_time);
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) {
database.erase();
}
pluginInstance.last_sorted_day = tm_ptr->tm_wday;
}
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

1
src/Plugins/RenX/RenX.Ladder.Weekly/RenX_Ladder_Weekly.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_ALL_TIME
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

23
src/Plugins/RenX/RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp

@ -20,22 +20,22 @@
#include "Jupiter/IRC_Client.h"
#include "RenX_Ladder_Yearly.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_Ladder_Yearly_TimePlugin::initialize()
{
bool RenX_Ladder_Yearly_TimePlugin::initialize() {
time_t current_time = time(0);
// Load database
this->database.process_file(this->config.get("LadderDatabase"_jrs, "Ladder.Yearly.db"_jrs));
this->database.setName(this->config.get("DatabaseName"_jrs, "Yearly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->database.process_file(this->config.get("LadderDatabase"sv, "Ladder.Yearly.db"sv));
this->database.setName(this->config.get("DatabaseName"sv, "Yearly"sv));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"sv, false));
this->last_sorted_year = gmtime(&current_time)->tm_year;
this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired
if (this->config.get<bool>("ForceDefault"_jrs, false))
if (this->config.get<bool>("ForceDefault"sv, false)) {
RenX::default_ladder_database = &this->database;
}
return true;
}
@ -43,16 +43,15 @@ bool RenX_Ladder_Yearly_TimePlugin::initialize()
// Plugin instantiation and entry point.
RenX_Ladder_Yearly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) {
time_t current_time = time(0);
tm *tm_ptr = gmtime(&current_time);
if (pluginInstance.last_sorted_year != tm_ptr->tm_year)
if (pluginInstance.last_sorted_year != tm_ptr->tm_year) {
database.erase();
}
pluginInstance.last_sorted_year = tm_ptr->tm_year;
}
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

1
src/Plugins/RenX/RenX.Ladder.Yearly/RenX_Ladder_Yearly.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_ALL_TIME
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

39
src/Plugins/RenX/RenX.Ladder/RenX_Ladder.cpp

@ -24,12 +24,11 @@
#include "RenX_PlayerInfo.h"
#include "RenX_BanDatabase.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_LadderPlugin::initialize() {
RenX_LadderPlugin::only_pure = this->config.get<bool>("OnlyPure"_jrs, false);
int mlcpno = this->config.get<int>("MaxLadderCommandPartNameOutput"_jrs, 5);
RenX_LadderPlugin::only_pure = this->config.get<bool>("OnlyPure"sv, false);
int mlcpno = this->config.get<int>("MaxLadderCommandPartNameOutput"sv, 5);
if (mlcpno < 0)
RenX_LadderPlugin::max_ladder_command_part_name_output = 0;
else
@ -65,9 +64,9 @@ void RenX_LadderPlugin::RenX_OnGameOver(RenX::Server &server, RenX::WinType winT
void RenX_LadderPlugin::RenX_OnCommand(RenX::Server &server, std::string_view ) {
if (jessilib::equalsi(server.getCurrentRCONCommand(), "clientvarlist"sv)) {
if (server.varData[this->name].get("w"_jrs, "0"_jrs) == "1"sv) {
if (server.varData[this->name].get("w"sv, "0"sv) == "1"sv) {
server.varData[this->name].set("w"sv, "0"s);
RenX::TeamType team = static_cast<RenX::TeamType>(server.varData[this->name].get("t"_jrs, "\0"_jrs)[0]);
RenX::TeamType team = static_cast<RenX::TeamType>(server.varData[this->name].get("t"sv, "\0"sv)[0]);
for (const auto& database : RenX::ladder_databases) {
database->updateLadder(server, team);
}
@ -84,7 +83,7 @@ RenX_LadderPlugin pluginInstance;
/** Ladder Commands */
Jupiter::StringS FormatLadderResponse(RenX::LadderDatabase::Entry *entry, size_t rank) {
std::string FormatLadderResponse(RenX::LadderDatabase::Entry *entry, size_t rank) {
return string_printf("#%" PRIuPTR ": \"%.*s\" - Score: %" PRIu64 " - Kills: %" PRIu32 " - Deaths: %" PRIu32 " - KDR: %.2f - SPM: %.2f",
rank, entry->most_recent_name.size(), entry->most_recent_name.data(), entry->total_score, entry->total_kills, entry->total_deaths,
static_cast<double>(entry->total_kills) / (entry->total_deaths == 0 ? 1 : static_cast<double>(entry->total_deaths)),
@ -94,17 +93,17 @@ Jupiter::StringS FormatLadderResponse(RenX::LadderDatabase::Entry *entry, size_t
// Ladder Command
LadderGenericCommand::LadderGenericCommand() {
this->addTrigger("ladder"_jrs);
this->addTrigger("rank"_jrs);
this->addTrigger("ladder"sv);
this->addTrigger("rank"sv);
}
Jupiter::GenericCommand::ResponseLine *LadderGenericCommand::trigger(std::string_view parameters) {
if (parameters.empty()) {
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: ladder <name | rank>"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Too few parameters. Syntax: ladder <name | rank>"sv, GenericCommand::DisplayType::PrivateError);
}
if (RenX::default_ladder_database == nullptr) {
return new Jupiter::GenericCommand::ResponseLine("Error: No default ladder database specified."_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: No default ladder database specified."sv, GenericCommand::DisplayType::PrivateError);
}
RenX::LadderDatabase::Entry *entry;
@ -113,18 +112,18 @@ Jupiter::GenericCommand::ResponseLine *LadderGenericCommand::trigger(std::string
if (parameters_view.find_first_not_of("0123456789"sv) == std::string_view::npos) {
rank = Jupiter::asUnsignedInt(parameters_view, 10);
if (rank == 0)
return new Jupiter::GenericCommand::ResponseLine("Error: Invalid parameters"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Invalid parameters"sv, GenericCommand::DisplayType::PrivateError);
entry = RenX::default_ladder_database->getPlayerEntryByIndex(rank - 1);
if (entry == nullptr)
return new Jupiter::GenericCommand::ResponseLine("Error: Player not found"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Player not found"sv, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine(FormatLadderResponse(entry, rank), GenericCommand::DisplayType::PublicSuccess);
}
std::forward_list<std::pair<RenX::LadderDatabase::Entry, size_t>> list = RenX::default_ladder_database->getPlayerEntriesAndIndexByPartName(parameters, pluginInstance.getMaxLadderCommandPartNameOutput());
if (list.empty())
return new Jupiter::GenericCommand::ResponseLine("Error: Player not found"_jrs, GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine("Error: Player not found"sv, GenericCommand::DisplayType::PrivateError);
std::pair<RenX::LadderDatabase::Entry, size_t> &head_pair = list.front();
Jupiter::GenericCommand::ResponseLine *response_head = new Jupiter::GenericCommand::ResponseLine(FormatLadderResponse(std::addressof(head_pair.first), head_pair.second + 1), GenericCommand::DisplayType::PrivateSuccess);
@ -141,7 +140,7 @@ Jupiter::GenericCommand::ResponseLine *LadderGenericCommand::trigger(std::string
}
std::string_view LadderGenericCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Fetches ladder information about a player. Syntax: ladder <name | rank>");
static constexpr std::string_view defaultHelp = "Fetches ladder information about a player. Syntax: ladder <name | rank>"sv;
return defaultHelp;
}
@ -151,8 +150,8 @@ GENERIC_COMMAND_AS_CONSOLE_COMMAND(LadderGenericCommand)
// Ladder Game Command
void LadderGameCommand::create() {
this->addTrigger("ladder"_jrs);
this->addTrigger("rank"_jrs);
this->addTrigger("ladder"sv);
this->addTrigger("rank"sv);
}
void LadderGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -164,13 +163,13 @@ void LadderGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
source->sendMessage(FormatLadderResponse(pair.first, pair.second + 1));
}
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!"sv);
}
else
source->sendMessage(*player, "Error: No default ladder database specified."_jrs);
source->sendMessage(*player, "Error: No default ladder database specified."sv);
}
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."sv);
}
else {
Jupiter::GenericCommand::ResponseLine *response = LadderGenericCommand_instance.trigger(parameters);
@ -185,7 +184,7 @@ void LadderGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
}
std::string_view LadderGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays ladder information about yourself, or another player. Syntax: ladder [name / rank]");
static constexpr std::string_view defaultHelp = "Displays ladder information about yourself, or another player. Syntax: ladder [name / rank]"sv;
return defaultHelp;
}

1
src/Plugins/RenX/RenX.Ladder/RenX_Ladder.h

@ -20,7 +20,6 @@
#define _RENX_LADDER_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "IRC_Command.h"
#include "RenX_Plugin.h"
#include "RenX_LadderDatabase.h"

14
src/Plugins/RenX/RenX.Listen/RenX_Listen.cpp

@ -21,16 +21,16 @@
#include "RenX_Core.h"
#include "RenX_Server.h"
using namespace Jupiter::literals;
using namespace std::literals;
RenX_ListenPlugin::~RenX_ListenPlugin() {
RenX_ListenPlugin::socket.close();
}
bool RenX_ListenPlugin::initialize() {
uint16_t port = this->config.get<uint16_t>("Port"_jrs, 21337);
std::string_view address = this->config.get("Address"_jrs, "0.0.0.0"_jrs);
RenX_ListenPlugin::serverSection = this->config.get("ServerSection"_jrs, this->getName());
uint16_t port = this->config.get<uint16_t>("Port"sv, 21337);
std::string_view address = this->config.get("Address"sv, "0.0.0.0"sv);
RenX_ListenPlugin::serverSection = this->config.get("ServerSection"sv, this->getName());
return RenX_ListenPlugin::socket.bind(static_cast<std::string>(address).c_str(), port, true) && RenX_ListenPlugin::socket.setBlocking(false);
}
@ -51,9 +51,9 @@ int RenX_ListenPlugin::think() {
int RenX_ListenPlugin::OnRehash() {
RenX::Plugin::OnRehash();
uint16_t port = this->config.get<uint16_t>("Port"_jrs, 21337);
std::string_view address = this->config.get("Address"_jrs, "0.0.0.0"_jrs);
RenX_ListenPlugin::serverSection = this->config.get("ServerSection"_jrs, this->getName());
uint16_t port = this->config.get<uint16_t>("Port"sv, 21337);
std::string_view address = this->config.get("Address"sv, "0.0.0.0"sv);
RenX_ListenPlugin::serverSection = this->config.get("ServerSection"sv, this->getName());
if (port != RenX_ListenPlugin::socket.getBoundPort() || address != RenX_ListenPlugin::socket.getBoundHostname()) {
puts("Notice: The Renegade-X listening socket has been changed!");

1
src/Plugins/RenX/RenX.Listen/RenX_Listen.h

@ -20,7 +20,6 @@
#define _EXAMPLE_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/TCPSocket.h"
#include "RenX_Plugin.h"

412
src/Plugins/RenX/RenX.Logging/RenX_Logging.cpp

@ -24,97 +24,97 @@
#include "RenX_Server.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_LoggingPlugin::initialize()
{
RenX_LoggingPlugin::muteOwnExecute = this->config.get<bool>("MuteOwnExecute"_jrs, true);
RenX_LoggingPlugin::playerRDNSPublic = this->config.get<bool>("PlayerRDNSPublic"_jrs, false);
RenX_LoggingPlugin::playerIdentifyPublic = this->config.get<bool>("PlayerIdentifyPublic"_jrs, false);
RenX_LoggingPlugin::joinPublic = this->config.get<bool>("JoinPublic"_jrs, true);
RenX_LoggingPlugin::partPublic = this->config.get<bool>("PartPublic"_jrs, true);
RenX_LoggingPlugin::kickPublic = this->config.get<bool>("KickPublic"_jrs, true);
RenX_LoggingPlugin::nameChangePublic = this->config.get<bool>("NameChangePublic"_jrs, true);
RenX_LoggingPlugin::teamChangePublic = this->config.get<bool>("TeamChangePublic"_jrs, true);
RenX_LoggingPlugin::speedHackPublic = this->config.get<bool>("SpeedHackPublic"_jrs, false);
RenX_LoggingPlugin::playerPublic = this->config.get<bool>("PlayerPublic"_jrs, false);
RenX_LoggingPlugin::chatPublic = this->config.get<bool>("ChatPublic"_jrs, true);
RenX_LoggingPlugin::teamChatPublic = this->config.get<bool>("TeamChatPublic"_jrs, false);
RenX_LoggingPlugin::radioChatPublic = this->config.get<bool>("RadioChatPublic"_jrs, false);
RenX_LoggingPlugin::hostChatPublic = this->config.get<bool>("HostChatPublic"_jrs, true);
RenX_LoggingPlugin::hostPagePublic = this->config.get<bool>("HostPagePublic"_jrs, false);
RenX_LoggingPlugin::adminMessagePublic = this->config.get<bool>("AdminMessagePublic"_jrs, true);
RenX_LoggingPlugin::adminPMessagePublic = this->config.get<bool>("AdminPagePublic"_jrs, false);
RenX_LoggingPlugin::otherChatPublic = this->config.get<bool>("OtherChatPublic"_jrs, false);
RenX_LoggingPlugin::deployPublic = this->config.get<bool>("DeployPublic"_jrs, true);
RenX_LoggingPlugin::mineDeployPublic = this->config.get<bool>("MineDeployPublic"_jrs, false);
RenX_LoggingPlugin::overMinePublic = this->config.get<bool>("OverMinePublic"_jrs, false);
RenX_LoggingPlugin::disarmPublic = this->config.get<bool>("DisarmPublic"_jrs, true);
RenX_LoggingPlugin::mineDisarmPublic = this->config.get<bool>("MineDisarmPublic"_jrs, false);
RenX_LoggingPlugin::explodePublic = this->config.get<bool>("ExplodePublic"_jrs, false);
RenX_LoggingPlugin::suicidePublic = this->config.get<bool>("SuicidePublic"_jrs, true);
RenX_LoggingPlugin::killPublic = this->config.get<bool>("KillPublic"_jrs, true);
RenX_LoggingPlugin::diePublic = this->config.get<bool>("DiePublic"_jrs, true);
RenX_LoggingPlugin::destroyPublic = this->config.get<bool>("DestroyPublic"_jrs, true);
RenX_LoggingPlugin::capturePublic = this->config.get<bool>("CapturePublic"_jrs, true);
RenX_LoggingPlugin::neutralizePublic = this->config.get<bool>("NeutralizePublic"_jrs, true);
RenX_LoggingPlugin::characterPurchasePublic = this->config.get<bool>("CharacterPurchasePublic"_jrs, false);
RenX_LoggingPlugin::itemPurchasePublic = this->config.get<bool>("ItemPurchasePublic"_jrs, false);
RenX_LoggingPlugin::weaponPurchasePublic = this->config.get<bool>("WeaponPurchasePublic"_jrs, false);
RenX_LoggingPlugin::refillPurchasePublic = this->config.get<bool>("RefillPurchasePublic"_jrs, false);
RenX_LoggingPlugin::vehiclePurchasePublic = this->config.get<bool>("VehiclePurchasePublic"_jrs, false);
RenX_LoggingPlugin::vehicleSpawnPublic = this->config.get<bool>("VehicleSpawnPublic"_jrs, true);
RenX_LoggingPlugin::spawnPublic = this->config.get<bool>("SpawnPublic"_jrs, true);
RenX_LoggingPlugin::botJoinPublic = this->config.get<bool>("BotJoinPublic"_jrs, true);
RenX_LoggingPlugin::vehicleCratePublic = this->config.get<bool>("VehicleCratePublic"_jrs, false);
RenX_LoggingPlugin::TSVehicleCratePublic = this->config.get<bool>("TSVehicleCratePublic"_jrs, RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::RAVehicleCratePublic = this->config.get<bool>("RAVehicleCratePublic"_jrs, RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::deathCratePublic = this->config.get<bool>("DeathCratePublic"_jrs, true);
RenX_LoggingPlugin::moneyCratePublic = this->config.get<bool>("MoneyCratePublic"_jrs, false);
RenX_LoggingPlugin::characterCratePublic = this->config.get<bool>("CharacterCratePublic"_jrs, false);
RenX_LoggingPlugin::spyCratePublic = this->config.get<bool>("SpyCratePublic"_jrs, false);
RenX_LoggingPlugin::refillCratePublic = this->config.get<bool>("RefillCratePublic"_jrs, false);
RenX_LoggingPlugin::timeBombCratePublic = this->config.get<bool>("TimeBombCratePublic"_jrs, false);
RenX_LoggingPlugin::speedCratePublic = this->config.get<bool>("SpeedCratePublic"_jrs, false);
RenX_LoggingPlugin::nukeCratePublic = this->config.get<bool>("NukeCratePublic"_jrs, true);
RenX_LoggingPlugin::abductionCratePublic = this->config.get<bool>("AbductionCratePublic"_jrs, true);
RenX_LoggingPlugin::unspecifiedCratePublic = this->config.get<bool>("UnspecifiedCratePublic"_jrs, false);
RenX_LoggingPlugin::otherCratePublic = this->config.get<bool>("OtherCratePublic"_jrs, false);
RenX_LoggingPlugin::stealPublic = this->config.get<bool>("StealPublic"_jrs, true);
RenX_LoggingPlugin::donatePublic = this->config.get<bool>("DonatePublic"_jrs, true);
RenX_LoggingPlugin::gamePublic = this->config.get<bool>("GamePublic"_jrs, true);
RenX_LoggingPlugin::gameOverPublic = this->config.get<bool>("GameOverPublic"_jrs, true);
RenX_LoggingPlugin::executePublic = this->config.get<bool>("ExecutePublic"_jrs, false);
RenX_LoggingPlugin::playerCommandPublic = this->config.get<bool>("PlayerCommandPublic"_jrs, false);
RenX_LoggingPlugin::subscribePublic = this->config.get<bool>("SubscribePublic"_jrs, false);
RenX_LoggingPlugin::RCONPublic = this->config.get<bool>("RCONPublic"_jrs, false);
RenX_LoggingPlugin::adminLoginPublic = this->config.get<bool>("AdminLoginPublic"_jrs, true);
RenX_LoggingPlugin::adminGrantPublic = this->config.get<bool>("AdminGrantPublic"_jrs, true);
RenX_LoggingPlugin::adminLogoutPublic = this->config.get<bool>("AdminLogoutPublic"_jrs, true);
RenX_LoggingPlugin::adminPublic = this->config.get<bool>("AdminPublic"_jrs, false);
RenX_LoggingPlugin::voteCallPublic = this->config.get<bool>("VoteCallPublic"_jrs, true);
RenX_LoggingPlugin::voteOverPublic = this->config.get<bool>("VoteOverPublic"_jrs, true);
RenX_LoggingPlugin::voteCancelPublic = this->config.get<bool>("VoteCancelPublic"_jrs, true);
RenX_LoggingPlugin::votePublic = this->config.get<bool>("VotePublic"_jrs, false);
RenX_LoggingPlugin::mapChangePublic = this->config.get<bool>("MapChangePublic"_jrs, true);
RenX_LoggingPlugin::mapLoadPublic = this->config.get<bool>("MapLoadPublic"_jrs, true);
RenX_LoggingPlugin::mapStartPublic = this->config.get<bool>("MapStartPublic"_jrs, true);
RenX_LoggingPlugin::mapPublic = this->config.get<bool>("MapPublic"_jrs, false);
RenX_LoggingPlugin::demoRecordPublic = this->config.get<bool>("DemoRecordPublic"_jrs, true);
RenX_LoggingPlugin::demoRecordStopPublic = this->config.get<bool>("DemoRecordStopPublic"_jrs, true);
RenX_LoggingPlugin::demoPublic = this->config.get<bool>("DemoPublic"_jrs, false);
RenX_LoggingPlugin::logPublic = this->config.get<bool>("LogPublic"_jrs, false);
RenX_LoggingPlugin::commandPublic = this->config.get<bool>("CommandPublic"_jrs, false);
RenX_LoggingPlugin::errorPublic = this->config.get<bool>("ErrorPublic"_jrs, false);
RenX_LoggingPlugin::versionPublic = this->config.get<bool>("VersionPublic"_jrs, true);
RenX_LoggingPlugin::authorizedPublic = this->config.get<bool>("AuthorizedPublic"_jrs, true);
RenX_LoggingPlugin::otherPublic = this->config.get<bool>("OtherPublic"_jrs, false);
RenX_LoggingPlugin::muteOwnExecute = this->config.get<bool>("MuteOwnExecute"sv, true);
RenX_LoggingPlugin::playerRDNSPublic = this->config.get<bool>("PlayerRDNSPublic"sv, false);
RenX_LoggingPlugin::playerIdentifyPublic = this->config.get<bool>("PlayerIdentifyPublic"sv, false);
RenX_LoggingPlugin::joinPublic = this->config.get<bool>("JoinPublic"sv, true);
RenX_LoggingPlugin::partPublic = this->config.get<bool>("PartPublic"sv, true);
RenX_LoggingPlugin::kickPublic = this->config.get<bool>("KickPublic"sv, true);
RenX_LoggingPlugin::nameChangePublic = this->config.get<bool>("NameChangePublic"sv, true);
RenX_LoggingPlugin::teamChangePublic = this->config.get<bool>("TeamChangePublic"sv, true);
RenX_LoggingPlugin::speedHackPublic = this->config.get<bool>("SpeedHackPublic"sv, false);
RenX_LoggingPlugin::playerPublic = this->config.get<bool>("PlayerPublic"sv, false);
RenX_LoggingPlugin::chatPublic = this->config.get<bool>("ChatPublic"sv, true);
RenX_LoggingPlugin::teamChatPublic = this->config.get<bool>("TeamChatPublic"sv, false);
RenX_LoggingPlugin::radioChatPublic = this->config.get<bool>("RadioChatPublic"sv, false);
RenX_LoggingPlugin::hostChatPublic = this->config.get<bool>("HostChatPublic"sv, true);
RenX_LoggingPlugin::hostPagePublic = this->config.get<bool>("HostPagePublic"sv, false);
RenX_LoggingPlugin::adminMessagePublic = this->config.get<bool>("AdminMessagePublic"sv, true);
RenX_LoggingPlugin::adminPMessagePublic = this->config.get<bool>("AdminPagePublic"sv, false);
RenX_LoggingPlugin::otherChatPublic = this->config.get<bool>("OtherChatPublic"sv, false);
RenX_LoggingPlugin::deployPublic = this->config.get<bool>("DeployPublic"sv, true);
RenX_LoggingPlugin::mineDeployPublic = this->config.get<bool>("MineDeployPublic"sv, false);
RenX_LoggingPlugin::overMinePublic = this->config.get<bool>("OverMinePublic"sv, false);
RenX_LoggingPlugin::disarmPublic = this->config.get<bool>("DisarmPublic"sv, true);
RenX_LoggingPlugin::mineDisarmPublic = this->config.get<bool>("MineDisarmPublic"sv, false);
RenX_LoggingPlugin::explodePublic = this->config.get<bool>("ExplodePublic"sv, false);
RenX_LoggingPlugin::suicidePublic = this->config.get<bool>("SuicidePublic"sv, true);
RenX_LoggingPlugin::killPublic = this->config.get<bool>("KillPublic"sv, true);
RenX_LoggingPlugin::diePublic = this->config.get<bool>("DiePublic"sv, true);
RenX_LoggingPlugin::destroyPublic = this->config.get<bool>("DestroyPublic"sv, true);
RenX_LoggingPlugin::capturePublic = this->config.get<bool>("CapturePublic"sv, true);
RenX_LoggingPlugin::neutralizePublic = this->config.get<bool>("NeutralizePublic"sv, true);
RenX_LoggingPlugin::characterPurchasePublic = this->config.get<bool>("CharacterPurchasePublic"sv, false);
RenX_LoggingPlugin::itemPurchasePublic = this->config.get<bool>("ItemPurchasePublic"sv, false);
RenX_LoggingPlugin::weaponPurchasePublic = this->config.get<bool>("WeaponPurchasePublic"sv, false);
RenX_LoggingPlugin::refillPurchasePublic = this->config.get<bool>("RefillPurchasePublic"sv, false);
RenX_LoggingPlugin::vehiclePurchasePublic = this->config.get<bool>("VehiclePurchasePublic"sv, false);
RenX_LoggingPlugin::vehicleSpawnPublic = this->config.get<bool>("VehicleSpawnPublic"sv, true);
RenX_LoggingPlugin::spawnPublic = this->config.get<bool>("SpawnPublic"sv, true);
RenX_LoggingPlugin::botJoinPublic = this->config.get<bool>("BotJoinPublic"sv, true);
RenX_LoggingPlugin::vehicleCratePublic = this->config.get<bool>("VehicleCratePublic"sv, false);
RenX_LoggingPlugin::TSVehicleCratePublic = this->config.get<bool>("TSVehicleCratePublic"sv, RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::RAVehicleCratePublic = this->config.get<bool>("RAVehicleCratePublic"sv, RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::deathCratePublic = this->config.get<bool>("DeathCratePublic"sv, true);
RenX_LoggingPlugin::moneyCratePublic = this->config.get<bool>("MoneyCratePublic"sv, false);
RenX_LoggingPlugin::characterCratePublic = this->config.get<bool>("CharacterCratePublic"sv, false);
RenX_LoggingPlugin::spyCratePublic = this->config.get<bool>("SpyCratePublic"sv, false);
RenX_LoggingPlugin::refillCratePublic = this->config.get<bool>("RefillCratePublic"sv, false);
RenX_LoggingPlugin::timeBombCratePublic = this->config.get<bool>("TimeBombCratePublic"sv, false);
RenX_LoggingPlugin::speedCratePublic = this->config.get<bool>("SpeedCratePublic"sv, false);
RenX_LoggingPlugin::nukeCratePublic = this->config.get<bool>("NukeCratePublic"sv, true);
RenX_LoggingPlugin::abductionCratePublic = this->config.get<bool>("AbductionCratePublic"sv, true);
RenX_LoggingPlugin::unspecifiedCratePublic = this->config.get<bool>("UnspecifiedCratePublic"sv, false);
RenX_LoggingPlugin::otherCratePublic = this->config.get<bool>("OtherCratePublic"sv, false);
RenX_LoggingPlugin::stealPublic = this->config.get<bool>("StealPublic"sv, true);
RenX_LoggingPlugin::donatePublic = this->config.get<bool>("DonatePublic"sv, true);
RenX_LoggingPlugin::gamePublic = this->config.get<bool>("GamePublic"sv, true);
RenX_LoggingPlugin::gameOverPublic = this->config.get<bool>("GameOverPublic"sv, true);
RenX_LoggingPlugin::executePublic = this->config.get<bool>("ExecutePublic"sv, false);
RenX_LoggingPlugin::playerCommandPublic = this->config.get<bool>("PlayerCommandPublic"sv, false);
RenX_LoggingPlugin::subscribePublic = this->config.get<bool>("SubscribePublic"sv, false);
RenX_LoggingPlugin::RCONPublic = this->config.get<bool>("RCONPublic"sv, false);
RenX_LoggingPlugin::adminLoginPublic = this->config.get<bool>("AdminLoginPublic"sv, true);
RenX_LoggingPlugin::adminGrantPublic = this->config.get<bool>("AdminGrantPublic"sv, true);
RenX_LoggingPlugin::adminLogoutPublic = this->config.get<bool>("AdminLogoutPublic"sv, true);
RenX_LoggingPlugin::adminPublic = this->config.get<bool>("AdminPublic"sv, false);
RenX_LoggingPlugin::voteCallPublic = this->config.get<bool>("VoteCallPublic"sv, true);
RenX_LoggingPlugin::voteOverPublic = this->config.get<bool>("VoteOverPublic"sv, true);
RenX_LoggingPlugin::voteCancelPublic = this->config.get<bool>("VoteCancelPublic"sv, true);
RenX_LoggingPlugin::votePublic = this->config.get<bool>("VotePublic"sv, false);
RenX_LoggingPlugin::mapChangePublic = this->config.get<bool>("MapChangePublic"sv, true);
RenX_LoggingPlugin::mapLoadPublic = this->config.get<bool>("MapLoadPublic"sv, true);
RenX_LoggingPlugin::mapStartPublic = this->config.get<bool>("MapStartPublic"sv, true);
RenX_LoggingPlugin::mapPublic = this->config.get<bool>("MapPublic"sv, false);
RenX_LoggingPlugin::demoRecordPublic = this->config.get<bool>("DemoRecordPublic"sv, true);
RenX_LoggingPlugin::demoRecordStopPublic = this->config.get<bool>("DemoRecordStopPublic"sv, true);
RenX_LoggingPlugin::demoPublic = this->config.get<bool>("DemoPublic"sv, false);
RenX_LoggingPlugin::logPublic = this->config.get<bool>("LogPublic"sv, false);
RenX_LoggingPlugin::commandPublic = this->config.get<bool>("CommandPublic"sv, false);
RenX_LoggingPlugin::errorPublic = this->config.get<bool>("ErrorPublic"sv, false);
RenX_LoggingPlugin::versionPublic = this->config.get<bool>("VersionPublic"sv, true);
RenX_LoggingPlugin::authorizedPublic = this->config.get<bool>("AuthorizedPublic"sv, true);
RenX_LoggingPlugin::otherPublic = this->config.get<bool>("OtherPublic"sv, false);
/** Event formats */
RenX_LoggingPlugin::playerRDNSFmt = this->config.get("PlayerRDNSFormat"_jrs,
""_jrs);
RenX_LoggingPlugin::playerRDNSFmt = this->config.get("PlayerRDNSFormat"sv,
""sv);
RenX_LoggingPlugin::playerIdentifyFmt = this->config.get("PlayerIdentifyFormat"_jrs,
RenX_LoggingPlugin::playerIdentifyFmt = this->config.get("PlayerIdentifyFormat"sv,
string_printf(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " (" IRCBOLD "%.*s" IRCBOLD ") joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD " (" IRCBOLD "%.*s" IRCBOLD ") with HWID " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->steamTag.size(),
RenX::tags->steamTag.data(), RenX::tags->teamLongTag.size(),
@ -123,148 +123,148 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->rdnsTag.data(), RenX::tags->hwidTag.size(),
RenX::tags->hwidTag.data()));
RenX_LoggingPlugin::joinPublicFmt = this->config.get("JoinPublicFormat"_jrs,
RenX_LoggingPlugin::joinPublicFmt = this->config.get("JoinPublicFormat"sv,
string_printf(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamLongTag.size(),
RenX::tags->teamLongTag.data()));
RenX_LoggingPlugin::joinAdminFmt = this->config.get("JoinAdminFormat"_jrs,
""_jrs);
RenX_LoggingPlugin::joinAdminFmt = this->config.get("JoinAdminFormat"sv,
""sv);
RenX_LoggingPlugin::joinNoSteamAdminFmt = this->config.get("JoinNoSteamAdminFormat"_jrs,
""_jrs);
RenX_LoggingPlugin::joinNoSteamAdminFmt = this->config.get("JoinNoSteamAdminFormat"sv,
""sv);
RenX_LoggingPlugin::partFmt = this->config.get("PartFormat"_jrs,
RenX_LoggingPlugin::partFmt = this->config.get("PartFormat"sv,
string_printf(IRCCOLOR "12[Part] " IRCBOLD "%.*s" IRCBOLD " left the %.*s.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamLongTag.size(),
RenX::tags->teamLongTag.data()));
RenX_LoggingPlugin::kickFmt = this->config.get("KickFormat"_jrs,
RenX_LoggingPlugin::kickFmt = this->config.get("KickFormat"sv,
string_printf(IRCCOLOR "04[Kick] " IRCBOLD "%.*s" IRCCOLOR IRCBOLD " was " IRCBOLD IRCCOLOR "04kicked" IRCCOLOR IRCBOLD " (" IRCCOLOR "04%.*s" IRCCOLOR ")", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::playerExecuteFmt = this->config.get("PlayerExecuteFormat"_jrs,
RenX_LoggingPlugin::playerExecuteFmt = this->config.get("PlayerExecuteFormat"sv,
string_printf("%.*s" IRCCOLOR "07 executed: %.*s", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::playerCommandSuccessFmt = this->config.get("PlayerCommandSuccessFormat"_jrs,
RenX_LoggingPlugin::playerCommandSuccessFmt = this->config.get("PlayerCommandSuccessFormat"sv,
string_printf("%.*s" IRCCOLOR ": " IRCCOLOR "10%.*s", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::playerCommandFailFmt = this->config.get("PlayerCommandFailFormat"_jrs, ""_jss);
RenX_LoggingPlugin::playerCommandFailFmt = this->config.get("PlayerCommandFailFormat"sv, ""s);
RenX_LoggingPlugin::playerFmt = this->config.get("PlayerFormat"_jrs,
RenX_LoggingPlugin::playerFmt = this->config.get("PlayerFormat"sv,
string_printf(IRCCOLOR "12[Player]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::nameChangeFmt = this->config.get("NameChangeFormat"_jrs,
RenX_LoggingPlugin::nameChangeFmt = this->config.get("NameChangeFormat"sv,
string_printf(IRCBOLD "%.*s" IRCBOLD " changed their name to " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->newNameTag.size(),
RenX::tags->newNameTag.data()));
RenX_LoggingPlugin::teamChangeFmt = this->config.get("TeamChangeFormat"_jrs,
RenX_LoggingPlugin::teamChangeFmt = this->config.get("TeamChangeFormat"sv,
string_printf("%.*s" IRCCOLOR " switched teams!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::speedHackFmt = this->config.get("SpeedHackFormat"_jrs,
RenX_LoggingPlugin::speedHackFmt = this->config.get("SpeedHackFormat"sv,
string_printf(IRCCOLOR "04[SpeedHack] " IRCBOLD "%.*s" IRCBOLD " has thrown a Speed Hack warning!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::chatFmt = this->config.get("ChatFormat"_jrs,
RenX_LoggingPlugin::chatFmt = this->config.get("ChatFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD ": %.*s", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::teamChatFmt = this->config.get("TeamChatFormat"_jrs,
RenX_LoggingPlugin::teamChatFmt = this->config.get("TeamChatFormat"sv,
string_printf(IRCBOLD "%.*s" IRCBOLD ": %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::radioChatFmt = this->config.get("RadioChatFormat"_jrs,
RenX_LoggingPlugin::radioChatFmt = this->config.get("RadioChatFormat"sv,
string_printf(IRCBOLD "%.*s" IRCBOLD ": \x1D%.*s", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::hostChatFmt = this->config.get("HostChatFormat"_jrs,
RenX_LoggingPlugin::hostChatFmt = this->config.get("HostChatFormat"sv,
string_printf(IRCCOLOR "12Host" IRCCOLOR "0: %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::hostPageFmt = this->config.get("HostPageFormat"_jrs,
RenX_LoggingPlugin::hostPageFmt = this->config.get("HostPageFormat"sv,
string_printf(IRCCOLOR "12(Host -> %.*s): %.*s", RenX::tags->rawNameTag.size(),
RenX::tags->rawNameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::adminMsgFmt = this->config.get("AdminMsgFormat"_jrs,
RenX_LoggingPlugin::adminMsgFmt = this->config.get("AdminMsgFormat"sv,
string_printf(IRCCOLOR "10%.*s: %.*s", RenX::tags->rawNameTag.size(), RenX::tags->rawNameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::warnMsgFmt = this->config.get("WarnMsgFormat"_jrs,
RenX_LoggingPlugin::warnMsgFmt = this->config.get("WarnMsgFormat"sv,
string_printf(IRCCOLOR "07%.*s: %.*s", RenX::tags->rawNameTag.size(), RenX::tags->rawNameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::pAdminMsgFmt = this->config.get("PAdminMsgFormat"_jrs,
RenX_LoggingPlugin::pAdminMsgFmt = this->config.get("PAdminMsgFormat"sv,
string_printf(IRCCOLOR "10(%.*s -> %.*s): %.*s", RenX::tags->rawNameTag.size(),
RenX::tags->rawNameTag.data(), RenX::tags->victimRawNameTag.size(),
RenX::tags->victimRawNameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::pWarnMsgFmt = this->config.get("PWarnMsgFormat"_jrs,
RenX_LoggingPlugin::pWarnMsgFmt = this->config.get("PWarnMsgFormat"sv,
string_printf(IRCCOLOR "07(%.*s -> %.*s): %.*s", RenX::tags->rawNameTag.size(),
RenX::tags->rawNameTag.data(), RenX::tags->victimRawNameTag.size(),
RenX::tags->victimRawNameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::otherChatFmt = this->config.get("OtherChatFormat"_jrs,
RenX_LoggingPlugin::otherChatFmt = this->config.get("OtherChatFormat"sv,
string_printf(IRCCOLOR "06[Other Chat]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::deployFmt = this->config.get("DeployFormat"_jrs,
RenX_LoggingPlugin::deployFmt = this->config.get("DeployFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " deployed a " IRCBOLD IRCCOLOR "12%.*s" IRCBOLD, RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::mineDeployFmt = this->config.get("MineDeployFormat"_jrs,
RenX_LoggingPlugin::mineDeployFmt = this->config.get("MineDeployFormat"sv,
RenX_LoggingPlugin::deployFmt);
RenX_LoggingPlugin::overMineFmt = this->config.get("OverMineFormat"_jrs,
RenX_LoggingPlugin::overMineFmt = this->config.get("OverMineFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " is " IRCCOLOR "04over-mining" IRCCOLOR ": " IRCBOLD IRCCOLOR "12%.*s" IRCBOLD, RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::disarmFmt = this->config.get("DisarmFormat"_jrs,
RenX_LoggingPlugin::disarmFmt = this->config.get("DisarmFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " disarmed %.*s" IRCBOLD IRCCOLOR "'s " IRCCOLOR "12%.*s" IRCBOLD, RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::mineDisarmFmt = this->config.get("MineDisarmFormat"_jrs,
RenX_LoggingPlugin::mineDisarmFmt = this->config.get("MineDisarmFormat"sv,
RenX_LoggingPlugin::disarmFmt);
RenX_LoggingPlugin::disarmNoOwnerFmt = this->config.get("DisarmNoOwnerFormat"_jrs,
RenX_LoggingPlugin::disarmNoOwnerFmt = this->config.get("DisarmNoOwnerFormat"sv,
string_printf(IRCBOLD "%.*s" IRCBOLD " disarmed a " IRCBOLD "%.*s" IRCBOLD, RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::mineDisarmNoOwnerFmt = this->config.get("MineDisarmNoOwnerFormat"_jrs,
RenX_LoggingPlugin::mineDisarmNoOwnerFmt = this->config.get("MineDisarmNoOwnerFormat"sv,
RenX_LoggingPlugin::disarmNoOwnerFmt);
RenX_LoggingPlugin::explodeFmt = this->config.get("ExplodeFormat"_jrs,
RenX_LoggingPlugin::explodeFmt = this->config.get("ExplodeFormat"sv,
string_printf("%.*s" IRCCOLOR " detonated a " IRCCOLOR "07%.*s" IRCCOLOR ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::explodeNoOwnerFmt = this->config.get("ExplodeNoOwnerFormat"_jrs,
RenX_LoggingPlugin::explodeNoOwnerFmt = this->config.get("ExplodeNoOwnerFormat"sv,
string_printf("A " IRCCOLOR "07%.*s" IRCCOLOR " detonated.", RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::suicideFmt = this->config.get("SuicideFormat"_jrs,
RenX_LoggingPlugin::suicideFmt = this->config.get("SuicideFormat"sv,
string_printf("%.*s" IRCCOLOR " suicided (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::killFmt = this->config.get("KillFormat"_jrs,
RenX_LoggingPlugin::killFmt = this->config.get("KillFormat"sv,
string_printf("%.*s" IRCCOLOR " killed %.*s" IRCCOLOR " (" IRCCOLOR "%.*s%.*s/%.*s" IRCCOLOR " vs " IRCCOLOR "%.*s%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data(), RenX::tags->teamColorTag.size(),
@ -274,32 +274,32 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->victimTeamColorTag.data(), RenX::tags->victimCharacterTag.size(),
RenX::tags->victimCharacterTag.data()));
RenX_LoggingPlugin::killFmt2 = this->config.get("KillFormat2"_jrs,
RenX_LoggingPlugin::killFmt2 = this->config.get("KillFormat2"sv,
string_printf(IRCCOLOR "%.*s%.*s" IRCCOLOR " killed %.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::dieFmt = this->config.get("DieFormat"_jrs,
RenX_LoggingPlugin::dieFmt = this->config.get("DieFormat"sv,
string_printf("%.*s" IRCCOLOR " died (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::dieFmt2 = this->config.get("DieFormat2"_jrs,
RenX_LoggingPlugin::dieFmt2 = this->config.get("DieFormat2"sv,
string_printf(IRCCOLOR "%.*s%.*s" IRCCOLOR " died (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyBuildingFmt = this->config.get("DestroyBuildingFormat"_jrs,
RenX_LoggingPlugin::destroyBuildingFmt = this->config.get("DestroyBuildingFormat"sv,
string_printf("%.*s" IRCCOLOR " destroyed the " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyBuildingFmt2 = this->config.get("DestroyBuildingFormat2"_jrs,
RenX_LoggingPlugin::destroyBuildingFmt2 = this->config.get("DestroyBuildingFormat2"sv,
string_printf(IRCCOLOR "%.*s%.*s" IRCCOLOR " destroyed the " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
@ -307,14 +307,14 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyDefenceFmt = this->config.get("DestroyDefenceFormat"_jrs,
RenX_LoggingPlugin::destroyDefenceFmt = this->config.get("DestroyDefenceFormat"sv,
string_printf("%.*s" IRCCOLOR " destroyed a " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyDefenceFmt2 = this->config.get("DestroyDefenceFormat2"_jrs,
RenX_LoggingPlugin::destroyDefenceFmt2 = this->config.get("DestroyDefenceFormat2"sv,
string_printf(IRCCOLOR "%.*s%.*s" IRCCOLOR " destroyed a " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
@ -322,14 +322,14 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyVehicleFmt = this->config.get("DestroyVehicleFormat"_jrs,
RenX_LoggingPlugin::destroyVehicleFmt = this->config.get("DestroyVehicleFormat"sv,
string_printf("%.*s" IRCCOLOR " destroyed a " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::destroyVehicleFmt2 = this->config.get("DestroyVehicleFormat2"_jrs,
RenX_LoggingPlugin::destroyVehicleFmt2 = this->config.get("DestroyVehicleFormat2"sv,
string_printf(IRCCOLOR "%.*s%.*s" IRCCOLOR " destroyed a " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
@ -337,158 +337,158 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->objectTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::captureFmt = this->config.get("CaptureFormat"_jrs,
RenX_LoggingPlugin::captureFmt = this->config.get("CaptureFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " captured the " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::neutralizeFmt = this->config.get("NeutralizeFormat"_jrs,
RenX_LoggingPlugin::neutralizeFmt = this->config.get("NeutralizeFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " neutralized the " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::characterPurchaseFmt = this->config.get("CharacterPurchaseFormat"_jrs,
RenX_LoggingPlugin::characterPurchaseFmt = this->config.get("CharacterPurchaseFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " purchased a " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->victimCharacterTag.size(),
RenX::tags->victimCharacterTag.data()));
RenX_LoggingPlugin::itemPurchaseFmt = this->config.get("ItemPurchaseFormat"_jrs,
RenX_LoggingPlugin::itemPurchaseFmt = this->config.get("ItemPurchaseFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " purchased a " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::weaponPurchaseFmt = this->config.get("WeaponPurchaseFormat"_jrs,
RenX_LoggingPlugin::weaponPurchaseFmt = this->config.get("WeaponPurchaseFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " purchased a " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::refillPurchaseFmt = this->config.get("RefillPurchaseFormat"_jrs,
RenX_LoggingPlugin::refillPurchaseFmt = this->config.get("RefillPurchaseFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " purchased a " IRCBOLD IRCCOLOR "%.*srefill" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data()));
RenX_LoggingPlugin::vehiclePurchaseFmt = this->config.get("VehiclePurchaseFormat"_jrs,
RenX_LoggingPlugin::vehiclePurchaseFmt = this->config.get("VehiclePurchaseFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " purchased a " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->victimVehicleTag.size(),
RenX::tags->victimVehicleTag.data()));
RenX_LoggingPlugin::vehicleSpawnFmt = this->config.get("VehicleSpawnFormat"_jrs,
RenX_LoggingPlugin::vehicleSpawnFmt = this->config.get("VehicleSpawnFormat"sv,
string_printf("A " IRCBOLD IRCCOLOR "%.*s%.*s" IRCCOLOR IRCBOLD " has spawned.", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->vehicleTag.size(),
RenX::tags->vehicleTag.data()));
RenX_LoggingPlugin::spawnFmt = this->config.get("SpawnFormat"_jrs,
RenX_LoggingPlugin::spawnFmt = this->config.get("SpawnFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " spawned as a " IRCCOLOR "%.*s%.*s.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->victimCharacterTag.size(),
RenX::tags->victimCharacterTag.data()));
RenX_LoggingPlugin::botJoinFmt = this->config.get("BotJoinFormat"_jrs,
RenX_LoggingPlugin::botJoinFmt = this->config.get("BotJoinFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " online.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::vehicleCrateFmt = this->config.get("VehicleCrateFormat"_jrs,
RenX_LoggingPlugin::vehicleCrateFmt = this->config.get("VehicleCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "12%.*s" IRCCOLOR " vehicle crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::TSVehicleCrateFmt = this->config.get("TSVehicleCrateFormat"_jrs,
RenX_LoggingPlugin::TSVehicleCrateFmt = this->config.get("TSVehicleCrateFormat"sv,
RenX_LoggingPlugin::vehicleCrateFmt);
RenX_LoggingPlugin::RAVehicleCrateFmt = this->config.get("RAVehicleCrateFormat"_jrs,
RenX_LoggingPlugin::RAVehicleCrateFmt = this->config.get("RAVehicleCrateFormat"sv,
RenX_LoggingPlugin::vehicleCrateFmt);
RenX_LoggingPlugin::deathCrateFmt = this->config.get("DeathCrateFormat"_jrs,
RenX_LoggingPlugin::deathCrateFmt = this->config.get("DeathCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "12death" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::moneyCrateFmt = this->config.get("MoneyCrateFormat"_jrs,
RenX_LoggingPlugin::moneyCrateFmt = this->config.get("MoneyCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up " IRCCOLOR "09%.*s credits" IRCCOLOR " from a " IRCCOLOR "12money" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::characterCrateFmt = this->config.get("CharacterCrateFormat"_jrs,
RenX_LoggingPlugin::characterCrateFmt = this->config.get("CharacterCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "%.*s%.*s" IRCCOLOR " " IRCCOLOR "12character" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->victimCharacterTag.size(),
RenX::tags->victimCharacterTag.data()));
RenX_LoggingPlugin::spyCrateFmt = this->config.get("SpyCrateFormat"_jrs,
RenX_LoggingPlugin::spyCrateFmt = this->config.get("SpyCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "%.*s%.*s" IRCCOLOR " " IRCCOLOR "12spy" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->victimCharacterTag.size(),
RenX::tags->victimCharacterTag.data()));
RenX_LoggingPlugin::refillCrateFmt = this->config.get("RefillCrateFormat"_jrs,
RenX_LoggingPlugin::refillCrateFmt = this->config.get("RefillCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "%.*srefill" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data()));
RenX_LoggingPlugin::timeBombCrateFmt = this->config.get("TimeBombCrateFormat"_jrs,
RenX_LoggingPlugin::timeBombCrateFmt = this->config.get("TimeBombCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "11time-bomb" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::speedCrateFmt = this->config.get("SpeedCrateFormat"_jrs,
RenX_LoggingPlugin::speedCrateFmt = this->config.get("SpeedCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "11speed" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::nukeCrateFmt = this->config.get("NukeCrateFormat"_jrs,
RenX_LoggingPlugin::nukeCrateFmt = this->config.get("NukeCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "04nuke" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::abductionCrateFmt = this->config.get("AbductionCrateFormat"_jrs,
RenX_LoggingPlugin::abductionCrateFmt = this->config.get("AbductionCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " has been " IRCBOLD IRCCOLOR "06abducted" IRCCOLOR IRCBOLD " by the " IRCBOLD IRCCOLOR "06Scrin" IRCCOLOR IRCBOLD "!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::unspecifiedCrateFmt = this->config.get("UnspecifiedCrateFormat"_jrs,
RenX_LoggingPlugin::unspecifiedCrateFmt = this->config.get("UnspecifiedCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up an " IRCCOLOR "13unspecified" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::otherCrateFmt = this->config.get("OtherCrateFormat"_jrs,
RenX_LoggingPlugin::otherCrateFmt = this->config.get("OtherCrateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "13%.*s" IRCCOLOR " crate.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::stealFmt = this->config.get("StealFormat"_jrs,
RenX_LoggingPlugin::stealFmt = this->config.get("StealFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " stole " IRCBOLD "%.*s" IRCBOLD "'s " IRCBOLD "%.*s" IRCBOLD "!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::stealNoOwnerFmt = this->config.get("StealNoOwnerFormat"_jrs,
RenX_LoggingPlugin::stealNoOwnerFmt = this->config.get("StealNoOwnerFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " stole a " IRCBOLD IRCCOLOR "12%.*s" IRCBOLD "!", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::donateFmt = this->config.get("DonateFormat"_jrs,
RenX_LoggingPlugin::donateFmt = this->config.get("DonateFormat"sv,
string_printf(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " donated " IRCCOLOR "09%.*s credits" IRCCOLOR " to " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data()));
RenX_LoggingPlugin::gameOverFmt = this->config.get("GameOverFormat"_jrs,
RenX_LoggingPlugin::gameOverFmt = this->config.get("GameOverFormat"sv,
string_printf(IRCCOLOR "03[Game]" IRCCOLOR "%.*s The " IRCBOLD "%.*s" IRCBOLD " won by " IRCBOLD "%.*s" IRCBOLD, RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->teamLongTag.size(),
RenX::tags->teamLongTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::gameOverTieFmt = this->config.get("GameOverTieNoWinFormat"_jrs,
RenX_LoggingPlugin::gameOverTieFmt = this->config.get("GameOverTieNoWinFormat"sv,
string_printf(IRCCOLOR "03[Game]" IRCCOLOR "10 The battle ended in a " IRCBOLD "%.*s" IRCBOLD " - Victory handed to " IRCBOLD IRCCOLOR "%.*s%.*s" IRCBOLD, RenX::tags->messageTag.size(),
RenX::tags->messageTag.data(), RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->teamLongTag.size(),
RenX::tags->teamLongTag.data()));
RenX_LoggingPlugin::gameOverTieNoWinFmt = this->config.get("GameOverTieFormat"_jrs,
RenX_LoggingPlugin::gameOverTieNoWinFmt = this->config.get("GameOverTieFormat"sv,
string_printf(IRCCOLOR "03[Game]" IRCCOLOR "10 The battle ended in a " IRCBOLD "%.*s" IRCBOLD, RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::gameOverScoreFmt = this->config.get("GameOverScoreFormat"_jrs,
RenX_LoggingPlugin::gameOverScoreFmt = this->config.get("GameOverScoreFormat"sv,
string_printf(IRCCOLOR "03[Game]" IRCCOLOR "%.*s %.*s" IRCCOLOR ": %.*s | " IRCCOLOR "%.*s%.*s" IRCCOLOR ": %.*s", RenX::tags->teamColorTag.size(),
RenX::tags->teamColorTag.data(), RenX::tags->teamLongTag.size(),
RenX::tags->teamLongTag.data(), RenX::tags->winScoreTag.size(),
@ -497,97 +497,97 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->victimTeamLongTag.data(), RenX::tags->loseScoreTag.size(),
RenX::tags->loseScoreTag.data()));
RenX_LoggingPlugin::gameFmt = this->config.get("GameFormat"_jrs,
RenX_LoggingPlugin::gameFmt = this->config.get("GameFormat"sv,
string_printf(IRCCOLOR "03[Game]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::executeFmt = this->config.get("ExecuteFormat"_jrs,
RenX_LoggingPlugin::executeFmt = this->config.get("ExecuteFormat"sv,
string_printf(IRCCOLOR "07%.*s executed: %.*s", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::devBotExecuteFmt = this->config.get("DevBotExecuteFormat"_jrs, ""_jss);
RenX_LoggingPlugin::devBotExecuteFmt = this->config.get("DevBotExecuteFormat"sv, ""s);
RenX_LoggingPlugin::subscribeFmt = this->config.get("SubscribeFormat"_jrs,
RenX_LoggingPlugin::subscribeFmt = this->config.get("SubscribeFormat"sv,
string_printf(IRCCOLOR "03%.*s subscribed to the RCON data stream.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::rconFmt = this->config.get("RCONFormat"_jrs,
RenX_LoggingPlugin::rconFmt = this->config.get("RCONFormat"sv,
string_printf(IRCCOLOR "05[RCON]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::adminLoginFmt = this->config.get("AdminLoginFormat"_jrs,
RenX_LoggingPlugin::adminLoginFmt = this->config.get("AdminLoginFormat"sv,
string_printf(IRCCOLOR "07[Admin] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " logged in with " IRCCOLOR "07" IRCBOLD "%.*s" IRCBOLD IRCNORMAL " privledges.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->adminTag.size(),
RenX::tags->adminTag.data()));
RenX_LoggingPlugin::adminGrantFmt = this->config.get("AdminGrantFormat"_jrs,
RenX_LoggingPlugin::adminGrantFmt = this->config.get("AdminGrantFormat"sv,
string_printf(IRCCOLOR "07[Admin] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " was granted " IRCCOLOR "07" IRCBOLD "%.*s" IRCBOLD IRCNORMAL " privledges.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->adminTag.size(),
RenX::tags->adminTag.data()));
RenX_LoggingPlugin::adminLogoutFmt = this->config.get("AdminLogoutFormat"_jrs,
RenX_LoggingPlugin::adminLogoutFmt = this->config.get("AdminLogoutFormat"sv,
string_printf(IRCCOLOR "07[Admin] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " logged out of their " IRCCOLOR "07" IRCBOLD "%.*s" IRCBOLD IRCNORMAL " privledges.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->adminTag.size(),
RenX::tags->adminTag.data()));
RenX_LoggingPlugin::adminFmt = this->config.get("AdminFormat"_jrs,
RenX_LoggingPlugin::adminFmt = this->config.get("AdminFormat"sv,
string_printf(IRCCOLOR "07[Admin]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::voteAddBotsFmt = this->config.get("VoteAddBotsFormat"_jrs,
RenX_LoggingPlugin::voteAddBotsFmt = this->config.get("VoteAddBotsFormat"sv,
string_printf(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for adding " IRCCOLOR "12%.*s" IRCCOLOR " bots to %.*s, with skill level " IRCCOLOR "07%.*s" IRCCOLOR ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->victimTeamShortTag.size(),
RenX::tags->victimTeamShortTag.data(), RenX::tags->weaponTag.size(),
RenX::tags->weaponTag.data()));
RenX_LoggingPlugin::voteChangeMapFmt = this->config.get("VoteChangeMapFormat"_jrs,
RenX_LoggingPlugin::voteChangeMapFmt = this->config.get("VoteChangeMapFormat"sv,
string_printf(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a Map Change.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::voteKickFmt = this->config.get("VoteKickFormat"_jrs,
RenX_LoggingPlugin::voteKickFmt = this->config.get("VoteKickFormat"sv,
string_printf(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a kick against %.*s" IRCNORMAL ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimNameTag.size(),
RenX::tags->victimNameTag.data()));
RenX_LoggingPlugin::voteMineBanFmt = this->config.get("VoteMineBanFormat"_jrs,
RenX_LoggingPlugin::voteMineBanFmt = this->config.get("VoteMineBanFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called for a Mine Ban against %.*s" IRCNORMAL ".", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::voteRemoveBotsFmt = this->config.get("VoteRemoveBotsFormat"_jrs,
RenX_LoggingPlugin::voteRemoveBotsFmt = this->config.get("VoteRemoveBotsFormat"sv,
string_printf(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called a vote to remove " IRCCOLOR "12%.*s" IRCCOLOR " bots from " IRCCOLOR "%.*s%.*s" IRCNORMAL ".", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->victimTeamShortTag.size(),
RenX::tags->victimTeamShortTag.data()));
RenX_LoggingPlugin::voteRestartMapFmt = this->config.get("VoteRestartMapFormat"_jrs,
RenX_LoggingPlugin::voteRestartMapFmt = this->config.get("VoteRestartMapFormat"sv,
string_printf(IRCCOLOR "[Vote] " IRCBOLD "%.*s" IRCNORMAL " has called for a Map Restart.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::voteSurrenderFmt = this->config.get("VoteSurrenderFormat"_jrs,
RenX_LoggingPlugin::voteSurrenderFmt = this->config.get("VoteSurrenderFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called for a Surrender.", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::voteSurveyFmt = this->config.get("VoteSurveyFormat"_jrs,
RenX_LoggingPlugin::voteSurveyFmt = this->config.get("VoteSurveyFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR "%.*s has started a Survey: " IRCCOLOR "12%.*s", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::voteOtherFmt = this->config.get("VoteOtherFormat"_jrs,
RenX_LoggingPlugin::voteOtherFmt = this->config.get("VoteOtherFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR "%.*s has called a \"%.*s\" vote.", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->nameTag.size(),
RenX::tags->nameTag.data(), RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::voteOverSuccessFmt = this->config.get("VoteOverSuccessFormat"_jrs,
RenX_LoggingPlugin::voteOverSuccessFmt = this->config.get("VoteOverSuccessFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" " IRCBOLD IRCCOLOR "09passed" IRCBOLD IRCCOLOR "%.*s (Votes Yes: %.*s | Votes No: %.*s).", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->victimTeamColorTag.size(),
@ -595,7 +595,7 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->winScoreTag.data(), RenX::tags->loseScoreTag.size(),
RenX::tags->loseScoreTag.data()));
RenX_LoggingPlugin::voteOverFailFmt = this->config.get("VoteOverFailFormat"_jrs,
RenX_LoggingPlugin::voteOverFailFmt = this->config.get("VoteOverFailFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" " IRCBOLD IRCCOLOR "04failed" IRCBOLD IRCCOLOR "%.*s (Votes Yes: %.*s | Votes No: %.*s).", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data(), RenX::tags->victimTeamColorTag.size(),
@ -603,64 +603,64 @@ bool RenX_LoggingPlugin::initialize()
RenX::tags->winScoreTag.data(), RenX::tags->loseScoreTag.size(),
RenX::tags->loseScoreTag.data()));
RenX_LoggingPlugin::voteCancelFmt = this->config.get("VoteCancelFormat"_jrs,
RenX_LoggingPlugin::voteCancelFmt = this->config.get("VoteCancelFormat"sv,
string_printf(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" was " IRCBOLD IRCCOLOR "07cancelled" IRCCOLOR IRCBOLD ".", RenX::tags->victimTeamColorTag.size(),
RenX::tags->victimTeamColorTag.data(), RenX::tags->objectTag.size(),
RenX::tags->objectTag.data()));
RenX_LoggingPlugin::voteFmt = this->config.get("VoteFormat"_jrs,
RenX_LoggingPlugin::voteFmt = this->config.get("VoteFormat"sv,
string_printf(IRCCOLOR "06[Vote]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::mapChangeFmt = this->config.get("MapChangeFormat"_jrs,
RenX_LoggingPlugin::mapChangeFmt = this->config.get("MapChangeFormat"sv,
string_printf(IRCCOLOR "03Loading %.*s...", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::mapLoadFmt = this->config.get("MapLoadFormat"_jrs,
RenX_LoggingPlugin::mapLoadFmt = this->config.get("MapLoadFormat"sv,
string_printf(IRCCOLOR "03%.*s loaded.", RenX::tags->messageTag.size(), RenX::tags->messageTag.data()));
RenX_LoggingPlugin::mapStartFmt = this->config.get("MapStartFormat"_jrs,
RenX_LoggingPlugin::mapStartFmt = this->config.get("MapStartFormat"sv,
string_printf(IRCCOLOR "03%.*s started.", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::mapFmt = this->config.get("MapFormat"_jrs,
RenX_LoggingPlugin::mapFmt = this->config.get("MapFormat"sv,
string_printf(IRCCOLOR "06[Map]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::demoRecordFmt = this->config.get("DemoRecordFormat"_jrs,
RenX_LoggingPlugin::demoRecordFmt = this->config.get("DemoRecordFormat"sv,
string_printf("%.*s has started a demo recording.", RenX::tags->nameTag.size(),
RenX::tags->nameTag.data()));
RenX_LoggingPlugin::rconDemoRecordFmt = this->config.get("RCONDemoRecordFormat"_jrs,
IRCCOLOR "07A demo recording has started."_jrs);
RenX_LoggingPlugin::rconDemoRecordFmt = this->config.get("RCONDemoRecordFormat"sv,
IRCCOLOR "07A demo recording has started."sv);
RenX_LoggingPlugin::demoRecordStopFmt = this->config.get("DemoRecordStopFormat"_jrs,
IRCCOLOR "07The demo recording has stopped."_jrs);
RenX_LoggingPlugin::demoRecordStopFmt = this->config.get("DemoRecordStopFormat"sv,
IRCCOLOR "07The demo recording has stopped."sv);
RenX_LoggingPlugin::demoFmt = this->config.get("DemoFormat"_jrs,
RenX_LoggingPlugin::demoFmt = this->config.get("DemoFormat"sv,
string_printf(IRCCOLOR "06[Demo]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::logFmt = this->config.get("LogFormat"_jrs,
RenX_LoggingPlugin::logFmt = this->config.get("LogFormat"sv,
string_printf(IRCCOLOR "07[Log]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::commandFmt = this->config.get("CommandFormat"_jrs,
RenX_LoggingPlugin::commandFmt = this->config.get("CommandFormat"sv,
string_printf("")); // Disabled by default.
RenX_LoggingPlugin::errorFmt = this->config.get("ErrorFormat"_jrs,
RenX_LoggingPlugin::errorFmt = this->config.get("ErrorFormat"sv,
string_printf(IRCCOLOR "04[Error]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
RenX_LoggingPlugin::versionFmt = this->config.get("VersionFormat"_jrs,
RenX_LoggingPlugin::versionFmt = this->config.get("VersionFormat"sv,
string_printf(IRCCOLOR "03Renegade X RCON connection established; using RCON verison " IRCBOLD "%.*s" IRCBOLD " for game version " IRCBOLD "%.*s" IRCBOLD, RenX::tags->rconVersionTag.size(),
RenX::tags->rconVersionTag.data(), RenX::tags->gameVersionTag.size(),
RenX::tags->gameVersionTag.data()));
RenX_LoggingPlugin::authorizedFmt = this->config.get("AuthorizedFormat"_jrs,
RenX_LoggingPlugin::authorizedFmt = this->config.get("AuthorizedFormat"sv,
string_printf(IRCCOLOR "03RCON authorization completed."));
RenX_LoggingPlugin::otherFmt = this->config.get("OtherFormat"_jrs,
RenX_LoggingPlugin::otherFmt = this->config.get("OtherFormat"sv,
string_printf(IRCCOLOR "06[Other]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(),
RenX::tags->messageTag.data()));
@ -1139,8 +1139,8 @@ void RenX_LoggingPlugin::RenX_OnHostAdminMessage(RenX::Server &server, std::stri
if (!msg.empty())
{
RenX::processTags(msg, &server);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_MESSAGE_TAG, message);
(server.*func)(msg);
}
@ -1158,8 +1158,8 @@ void RenX_LoggingPlugin::RenX_OnHostAdminPMessage(RenX::Server &server, const Re
if (!msg.empty())
{
RenX::processTags(msg, &server, nullptr, &player);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_MESSAGE_TAG, message);
(server.*func)(msg);
}
@ -1177,8 +1177,8 @@ void RenX_LoggingPlugin::RenX_OnHostWarnMessage(RenX::Server &server, std::strin
if (!msg.empty())
{
RenX::processTags(msg, &server);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_MESSAGE_TAG, message);
(server.*func)(msg);
}
@ -1196,8 +1196,8 @@ void RenX_LoggingPlugin::RenX_OnHostWarnPMessage(RenX::Server &server, const Ren
if (!msg.empty())
{
RenX::processTags(msg, &server, nullptr, &player);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"_jrs);
RenX::replace_tag(msg, RenX::tags->INTERNAL_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_RAW_NAME_TAG, "Host"sv);
RenX::replace_tag(msg, RenX::tags->INTERNAL_MESSAGE_TAG, message);
(server.*func)(msg);
}

117
src/Plugins/RenX/RenX.Medals/RenX_Medals.cpp

@ -28,7 +28,6 @@
#include "RenX_Core.h"
#include "RenX_Tags.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_MedalsPlugin::initialize()
@ -52,8 +51,8 @@ RenX_MedalsPlugin::~RenX_MedalsPlugin()
if (server->players.size() != 0) {
for (auto node = server->players.begin(); node != server->players.end(); ++node) {
if (!node->uuid.empty() && !node->isBot) {
RenX_MedalsPlugin::medalsFile[node->uuid].set("Recs"_jrs, node->varData[this->getName()].get("Recs"sv, ""s));
RenX_MedalsPlugin::medalsFile[node->uuid].set("Noobs"_jrs, node->varData[this->getName()].get("Noobs"sv, ""s));
RenX_MedalsPlugin::medalsFile[node->uuid].set("Recs"sv, node->varData[this->getName()].get("Recs"sv, ""s));
RenX_MedalsPlugin::medalsFile[node->uuid].set("Noobs"sv, node->varData[this->getName()].get("Noobs"sv, ""s));
}
}
}
@ -65,7 +64,7 @@ RenX_MedalsPlugin::~RenX_MedalsPlugin()
struct CongratPlayerData
{
RenX::Server *server;
Jupiter::StringS playerName;
std::string playerName;
unsigned int type;
};
@ -78,16 +77,16 @@ void congratPlayer(unsigned int, void *params)
switch (congratPlayerData->type)
{
case 0:
congratPlayerData->server->sendMessage(congratPlayerData->playerName + " has been recommended for having the highest score last game!"_jrs);
congratPlayerData->server->sendMessage(jessilib::join<std::string>(congratPlayerData->playerName, " has been recommended for having the highest score last game!"sv));
break;
case 1:
congratPlayerData->server->sendMessage(congratPlayerData->playerName + " has been recommended for having the most kills last game!"_jrs);
congratPlayerData->server->sendMessage(jessilib::join<std::string>(congratPlayerData->playerName, " has been recommended for having the most kills last game!"sv));
break;
case 2:
congratPlayerData->server->sendMessage(congratPlayerData->playerName + " has been recommended for having the most vehicle kills last game!"_jrs);
congratPlayerData->server->sendMessage(jessilib::join<std::string>(congratPlayerData->playerName, " has been recommended for having the most vehicle kills last game!"sv));
break;
case 3:
congratPlayerData->server->sendMessage(congratPlayerData->playerName + " has been recommended for having the highest Kill-Death ratio last game!"_jrs);
congratPlayerData->server->sendMessage(jessilib::join<std::string>(congratPlayerData->playerName, " has been recommended for having the highest Kill-Death ratio last game!"sv));
break;
default:
break;
@ -104,8 +103,8 @@ void RenX_MedalsPlugin::RenX_SanitizeTags(std::string& fmt) {
void RenX_MedalsPlugin::RenX_ProcessTags(std::string& msg, const RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *, const RenX::BuildingInfo *) {
if (player != nullptr) {
std::string_view recs = RenX_MedalsPlugin::medalsFile.get(player->uuid, "Recs"_jrs);
std::string_view noobs = RenX_MedalsPlugin::medalsFile.get(player->uuid, "Noobs"_jrs);
std::string_view recs = RenX_MedalsPlugin::medalsFile.get(player->uuid, "Recs"sv);
std::string_view noobs = RenX_MedalsPlugin::medalsFile.get(player->uuid, "Noobs"sv);
RenX::replace_tag(msg, this->INTERNAL_RECS_TAG, recs);
RenX::replace_tag(msg, this->INTERNAL_NOOB_TAG, noobs);
@ -122,8 +121,8 @@ void RenX_MedalsPlugin::RenX_OnPlayerCreate(RenX::Server &, const RenX::PlayerIn
void RenX_MedalsPlugin::RenX_OnPlayerDelete(RenX::Server &, const RenX::PlayerInfo &player) {
if (!player.uuid.empty() && player.isBot == false) {
RenX_MedalsPlugin::medalsFile[player.uuid].set("Recs"_jrs, player.varData[this->getName()].get("Recs"sv, ""s));
RenX_MedalsPlugin::medalsFile[player.uuid].set("Noobs"_jrs, player.varData[this->getName()].get("Noobs"sv, ""s));
RenX_MedalsPlugin::medalsFile[player.uuid].set("Recs"sv, player.varData[this->getName()].get("Recs"sv, ""s));
RenX_MedalsPlugin::medalsFile[player.uuid].set("Noobs"sv, player.varData[this->getName()].get("Noobs"sv, ""s));
}
}
@ -132,9 +131,11 @@ void RenX_MedalsPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo
int worth = getWorth(player);
Jupiter::Config *section = RenX_MedalsPlugin::config.getSection(RenX_MedalsPlugin::firstSection);
if (section != nullptr) {
while (section->get<int>("MaxRecs"_jrs, INT_MAX) < worth)
if ((section = RenX_MedalsPlugin::config.getSection(section->get("NextSection"_jrs))) == nullptr)
while (section->get<int>("MaxRecs"sv, std::numeric_limits<int>::max()) < worth) {
if ((section = RenX_MedalsPlugin::config.getSection(section->get("NextSection"sv))) == nullptr) {
return; // No matching section found.
}
}
size_t table_size = section->getTable().size();
@ -253,15 +254,15 @@ int RenX_MedalsPlugin::OnRehash()
void RenX_MedalsPlugin::init()
{
RenX_MedalsPlugin::killCongratDelay = std::chrono::seconds(this->config.get<long long>("KillCongratDelay"_jrs, 60));
RenX_MedalsPlugin::vehicleKillCongratDelay = std::chrono::seconds(this->config.get<long long>("VehicleKillCongratDelay"_jrs, 60));
RenX_MedalsPlugin::kdrCongratDelay = std::chrono::seconds(this->config.get<long long>("KDRCongratDelay"_jrs, 60));
RenX_MedalsPlugin::medalsFileName = this->config.get("MedalsFile"_jrs, "Medals.ini"_jrs);
RenX_MedalsPlugin::killCongratDelay = std::chrono::seconds(this->config.get<long long>("KillCongratDelay"sv, 60));
RenX_MedalsPlugin::vehicleKillCongratDelay = std::chrono::seconds(this->config.get<long long>("VehicleKillCongratDelay"sv, 60));
RenX_MedalsPlugin::kdrCongratDelay = std::chrono::seconds(this->config.get<long long>("KDRCongratDelay"sv, 60));
RenX_MedalsPlugin::medalsFileName = this->config.get("MedalsFile"sv, "Medals.ini"sv);
RenX_MedalsPlugin::medalsFile.read(RenX_MedalsPlugin::medalsFileName);
RenX_MedalsPlugin::firstSection = RenX_MedalsPlugin::config.get("FirstSection"_jrs);
RenX_MedalsPlugin::recsTag = RenX_MedalsPlugin::config.get("RecsTag"_jrs, "{RECS}"_jrs);
RenX_MedalsPlugin::noobTag = RenX_MedalsPlugin::config.get("NoobsTag"_jrs, "{NOOBS}"_jrs);
RenX_MedalsPlugin::worthTag = RenX_MedalsPlugin::config.get("WorthTag"_jrs, "{WORTH}"_jrs);
RenX_MedalsPlugin::firstSection = RenX_MedalsPlugin::config.get("FirstSection"sv);
RenX_MedalsPlugin::recsTag = RenX_MedalsPlugin::config.get("RecsTag"sv, "{RECS}"sv);
RenX_MedalsPlugin::noobTag = RenX_MedalsPlugin::config.get("NoobsTag"sv, "{NOOBS}"sv);
RenX_MedalsPlugin::worthTag = RenX_MedalsPlugin::config.get("WorthTag"sv, "{WORTH}"sv);
RenX::Core *core = RenX::getCore();
size_t server_count = core->getServerCount();
@ -286,11 +287,11 @@ RenX_MedalsPlugin pluginInstance;
void RecsGameCommand::create()
{
this->addTrigger("recs"_jrs);
this->addTrigger("recommends"_jrs);
this->addTrigger("recommendations"_jrs);
this->addTrigger("noobs"_jrs);
this->addTrigger("n00bs"_jrs);
this->addTrigger("recs"sv);
this->addTrigger("recommends"sv);
this->addTrigger("recommendations"sv);
this->addTrigger("noobs"sv);
this->addTrigger("n00bs"sv);
}
void RecsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters)
@ -302,32 +303,32 @@ void RecsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
{
Jupiter::Config *section = pluginInstance.medalsFile.getSection(parameters);
if (section == nullptr)
source->sendMessage(*player, "Error: Player not found! Syntax: recs [player]"_jrs);
source->sendMessage(*player, "Error: Player not found! Syntax: recs [player]"sv);
else
{
unsigned int recs = section->get<unsigned int>("Recs"_jrs);
unsigned int noobs = section->get<unsigned int>("Noobs"_jrs);
unsigned int recs = section->get<unsigned int>("Recs"sv);
unsigned int noobs = section->get<unsigned int>("Noobs"sv);
source->sendMessage(*player, string_printf("[Archive] %.*s has %u and %u n00bs. Their worth: %d", section->getName().size(), section->getName().c_str(), recs, noobs, recs - noobs));
}
}
else if (target->uuid.empty())
source->sendMessage(*player, "Error: Player is not using steam."_jrs);
source->sendMessage(*player, "Error: Player is not using steam."sv);
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."sv);
else if (target == player)
RecsGameCommand::trigger(source, player, ""_jrs);
RecsGameCommand::trigger(source, player, ""sv);
else
source->sendMessage(*player, string_printf("%.*s has %lu and %lu n00bs. Their worth: %d", target->name.size(), target->name.data(), getRecs(*target), getNoobs(*target), getWorth(*target)));
}
else if (player->uuid.empty())
source->sendMessage(*player, "Error: You are not using steam."_jrs);
source->sendMessage(*player, "Error: You are not using steam."sv);
else
source->sendMessage(*player, string_printf("%.*s, you have %lu recs and %lu n00bs. Your worth: %d", player->name.size(), player->name.data(), getRecs(*player), getNoobs(*player), getWorth(*player)));
}
std::string_view RecsGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Gets a count of a player's recommendations and noobs. Syntax: recs [player]");
static constexpr std::string_view defaultHelp = "Gets a count of a player's recommendations and noobs. Syntax: recs [player]"sv;
return defaultHelp;
}
@ -337,8 +338,8 @@ GAME_COMMAND_INIT(RecsGameCommand)
void RecGameCommand::create()
{
this->addTrigger("rec"_jrs);
this->addTrigger("recommend"_jrs);
this->addTrigger("rec"sv);
this->addTrigger("recommend"sv);
}
void RecGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -349,25 +350,25 @@ void RecGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std
target = source->getPlayerByPartName(parameters_split.first);
}
if (target == nullptr) {
source->sendMessage(*player, "Error: Player not found! Syntax: rec <player>"_jrs);
source->sendMessage(*player, "Error: Player not found! Syntax: rec <player>"sv);
}
else if (target->uuid.empty()) {
source->sendMessage(*player, "Error: Player is not using steam."_jrs);
source->sendMessage(*player, "Error: Player is not using steam."sv);
}
else if (target->isBot) {
source->sendMessage(*player, "Error: Bots can not receive recommendations."_jrs);
source->sendMessage(*player, "Error: Bots can not receive recommendations."sv);
}
else if (target == 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)"sv);
}
else if (!player->varData["RenX.Medals"_jrs].get("gr"_jrs).empty() && player->adminType.empty()) {
source->sendMessage(*player, "You can only give one recommendation per game."_jrs);
else if (!player->varData["RenX.Medals"sv].get("gr"sv).empty() && player->adminType.empty()) {
source->sendMessage(*player, "You can only give one recommendation per game."sv);
}
else {
addRec(*target);
source->sendMessage(string_printf("%.*s has recommended %.*s!", player->name.size(), player->name.data(), target->name.size(), target->name.data()));
player->varData["RenX.Medals"_jrs].set("gr"_jrs, "1"s);
player->varData["RenX.Medals"sv].set("gr"sv, "1"s);
}
}
else RecsGameCommand_instance.trigger(source, player, parameters);
@ -375,7 +376,7 @@ void RecGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std
std::string_view RecGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Recommends a player for their gameplay. Syntax: rec <player> [reason]");
static constexpr std::string_view defaultHelp = "Recommends a player for their gameplay. Syntax: rec <player> [reason]"sv;
return defaultHelp;
}
@ -385,8 +386,8 @@ GAME_COMMAND_INIT(RecGameCommand)
void NoobGameCommand::create()
{
this->addTrigger("noob"_jrs);
this->addTrigger("n00b"_jrs);
this->addTrigger("noob"sv);
this->addTrigger("n00b"sv);
}
void NoobGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -397,21 +398,21 @@ void NoobGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
target = source->getPlayerByPartName(parameters_split.first);
}
if (target == nullptr) {
source->sendMessage(*player, "Error: Player not found! Syntax: noob [player]"_jrs);
source->sendMessage(*player, "Error: Player not found! Syntax: noob [player]"sv);
}
else if (target->uuid.empty()) {
source->sendMessage(*player, "Error: Player is not using steam."_jrs);
source->sendMessage(*player, "Error: Player is not using steam."sv);
}
else if (target->isBot) {
source->sendMessage(*player, "Error: Bots can not receive n00bs."_jrs);
source->sendMessage(*player, "Error: Bots can not receive n00bs."sv);
}
else if (!player->varData["RenX.Medals"_jrs].get("gn"_jrs).empty() && player->adminType.empty()) {
source->sendMessage(*player, "You can only give one noob per game."_jrs);
else if (!player->varData["RenX.Medals"sv].get("gn"sv).empty() && player->adminType.empty()) {
source->sendMessage(*player, "You can only give one noob per game."sv);
}
else {
addNoob(*target);
source->sendMessage(string_printf("%.*s has noob'd %.*s!", player->name.size(), player->name.data(), target->name.size(), target->name.data()));
player->varData["RenX.Medals"_jrs].set("gn"_jrs, "1"s);
player->varData["RenX.Medals"sv].set("gn"sv, "1"s);
}
}
else RecsGameCommand_instance.trigger(source, player, parameters);
@ -419,7 +420,7 @@ void NoobGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
std::string_view NoobGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Tells people that a player is bad. Syntax: noob [player]");
static constexpr std::string_view defaultHelp = "Tells people that a player is bad. Syntax: noob [player]"sv;
return defaultHelp;
}
@ -427,24 +428,24 @@ GAME_COMMAND_INIT(NoobGameCommand)
void addRec(const RenX::PlayerInfo &player, int amount) {
if (!jessilib::starts_withi(player.uuid, "Player"sv) && !player.isBot) {
player.varData[pluginInstance.getName()].set("Recs"_jrs, static_cast<std::string>(string_printf("%u", getRecs(player) + amount)));
player.varData[pluginInstance.getName()].set("Recs"sv, static_cast<std::string>(string_printf("%u", getRecs(player) + amount)));
}
}
void addNoob(const RenX::PlayerInfo &player, int amount) {
if (!jessilib::starts_withi(player.uuid, "Player"sv) && !player.isBot) {
player.varData[pluginInstance.getName()].set("Noobs"_jrs,static_cast<std::string>(string_printf("%u", getNoobs(player) + amount)));
player.varData[pluginInstance.getName()].set("Noobs"sv,static_cast<std::string>(string_printf("%u", getNoobs(player) + amount)));
}
}
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"sv);
}
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"sv);
}
int getWorth(const RenX::PlayerInfo &player)

15
src/Plugins/RenX/RenX.Medals/RenX_Medals.h

@ -21,7 +21,6 @@
#include <chrono>
#include "Jupiter/Plugin.h"
#include "Jupiter/String.hpp"
#include "RenX_Plugin.h"
#include "RenX_GameCommand.h"
@ -60,17 +59,17 @@ public:
std::chrono::milliseconds killCongratDelay;
std::chrono::milliseconds vehicleKillCongratDelay;
std::chrono::milliseconds kdrCongratDelay;
Jupiter::StringS recsTag;
Jupiter::StringS noobTag;
Jupiter::StringS worthTag;
std::string recsTag;
std::string noobTag;
std::string worthTag;
std::string firstSection;
Jupiter::StringS medalsFileName;
std::string medalsFileName;
Jupiter::INIConfig medalsFile;
private:
Jupiter::StringS INTERNAL_RECS_TAG;
Jupiter::StringS INTERNAL_NOOB_TAG;
Jupiter::StringS INTERNAL_WORTH_TAG;
std::string INTERNAL_RECS_TAG;
std::string INTERNAL_NOOB_TAG;
std::string INTERNAL_WORTH_TAG;
void init();
};

82
src/Plugins/RenX/RenX.MinPlayers/RenX_MinPlayers.cpp

@ -21,56 +21,48 @@
#include "RenX_PlayerInfo.h"
#include "RenX_MinPlayers.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_MinPlayersPlugin::initialize()
{
RenX_MinPlayersPlugin::player_threshold = this->config.get<size_t>("PlayerThreshold"_jrs, 20);
bool RenX_MinPlayersPlugin::initialize() {
RenX_MinPlayersPlugin::player_threshold = this->config.get<size_t>("PlayerThreshold"sv, 20);
return true;
}
void RenX_MinPlayersPlugin::RenX_OnMapStart(RenX::Server &server, std::string_view map)
{
if (server.players.size() < RenX_MinPlayersPlugin::player_threshold)
void RenX_MinPlayersPlugin::RenX_OnMapStart(RenX::Server &server, std::string_view map) {
if (server.players.size() < RenX_MinPlayersPlugin::player_threshold) {
server.send(string_printf("addbots %d", RenX_MinPlayersPlugin::player_threshold - server.players.size()));
}
}
void RenX_MinPlayersPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player)
{
if (server.players.size() > RenX_MinPlayersPlugin::player_threshold && server.isMatchInProgress())
void RenX_MinPlayersPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) {
if (server.players.size() > RenX_MinPlayersPlugin::player_threshold && server.isMatchInProgress()) {
++RenX_MinPlayersPlugin::phase_bots;
}
}
void RenX_MinPlayersPlugin::RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player)
{
if (server.isMatchInProgress() && server.players.size() <= player_threshold)
{
switch (player.team)
{
void RenX_MinPlayersPlugin::RenX_OnPart(RenX::Server &server, const RenX::PlayerInfo &player) {
if (server.isMatchInProgress() && server.players.size() <= player_threshold) {
switch (player.team) {
case RenX::TeamType::GDI:
server.send("addredbots 1"_jrs);
server.send("addredbots 1"sv);
break;
case RenX::TeamType::Nod:
server.send("addbluebots 1"_jrs);
server.send("addbluebots 1"sv);
break;
case RenX::TeamType::None:
break;
default:
server.send("addbots 1"_jrs);
server.send("addbots 1"sv);
break;
}
}
}
void RenX_MinPlayersPlugin::AnyDeath(RenX::Server &server, const RenX::PlayerInfo &player)
{
if (RenX_MinPlayersPlugin::phase_bots != 0 && player.isBot && server.players.size() != 0)
{
void RenX_MinPlayersPlugin::AnyDeath(RenX::Server &server, const RenX::PlayerInfo &player) {
if (RenX_MinPlayersPlugin::phase_bots != 0 && player.isBot && server.players.size() != 0) {
size_t gdi_count = 0, nod_count = 0;
for (auto node = server.players.begin(); node != server.players.end(); ++node)
{
switch (node->team)
{
for (auto node = server.players.begin(); node != server.players.end(); ++node) {
switch (node->team) {
case RenX::TeamType::GDI:
++gdi_count;
break;
@ -82,54 +74,44 @@ void RenX_MinPlayersPlugin::AnyDeath(RenX::Server &server, const RenX::PlayerInf
}
}
if (gdi_count > nod_count)
{
if (player.team != RenX::TeamType::Nod)
{
server.kickPlayer(player, "Bot Phasing"_jrs);
if (gdi_count > nod_count) {
if (player.team != RenX::TeamType::Nod) {
server.kickPlayer(player, "Bot Phasing"sv);
--RenX_MinPlayersPlugin::phase_bots;
}
}
else if (nod_count > gdi_count)
{
if (player.team != RenX::TeamType::GDI)
{
server.kickPlayer(player, "Bot Phasing"_jrs);
else if (nod_count > gdi_count) {
if (player.team != RenX::TeamType::GDI) {
server.kickPlayer(player, "Bot Phasing"sv);
--RenX_MinPlayersPlugin::phase_bots;
}
}
else
{
server.kickPlayer(player, "Bot Phasing"_jrs);
else {
server.kickPlayer(player, "Bot Phasing"sv);
--RenX_MinPlayersPlugin::phase_bots;
}
}
}
void RenX_MinPlayersPlugin::RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, std::string_view damageType)
{
void RenX_MinPlayersPlugin::RenX_OnSuicide(RenX::Server &server, const RenX::PlayerInfo &player, std::string_view damageType) {
this->AnyDeath(server, player);
}
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, std::string_view damageType)
{
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, const RenX::PlayerInfo &player, const RenX::PlayerInfo &victim, std::string_view damageType) {
this->AnyDeath(server, player);
}
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, std::string_view killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo &victim, std::string_view damageType)
{
void RenX_MinPlayersPlugin::RenX_OnKill(RenX::Server &server, std::string_view killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo &victim, std::string_view damageType) {
this->AnyDeath(server, victim);
}
void RenX_MinPlayersPlugin::RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, std::string_view damageType)
{
void RenX_MinPlayersPlugin::RenX_OnDie(RenX::Server &server, const RenX::PlayerInfo &player, std::string_view damageType) {
this->AnyDeath(server, player);
}
// Plugin instantiation and entry point.
RenX_MinPlayersPlugin pluginInstance;
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin() {
return &pluginInstance;
}

1
src/Plugins/RenX/RenX.MinPlayers/RenX_MinPlayers.h

@ -20,7 +20,6 @@
#define _RENX_MINPLAYERS_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_MinPlayersPlugin : public RenX::Plugin

318
src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.cpp

@ -26,36 +26,35 @@
#include "RenX_Core.h"
#include "RenX_Functions.h"
using namespace Jupiter::literals;
using namespace std::literals;
constexpr std::string_view game_administrator_name = "administrator"sv;
constexpr std::string_view game_moderator_name = "moderator"sv;
bool RenX_ModSystemPlugin::initialize() {
m_lockSteam = this->config.get<bool>("LockSteam"_jrs, true);
m_lockIP = this->config.get<bool>("LockIP"_jrs, false);
m_lockName = this->config.get<bool>("LockName"_jrs, false);
m_kickLockMismatch = this->config.get<bool>("KickLockMismatch"_jrs, true);
m_autoAuthSteam = this->config.get<bool>("AutoAuthSteam"_jrs, true);
m_autoAuthIP = this->config.get<bool>("AutoAuthIP"_jrs, false);
m_atmDefault = this->config.get("ATMDefault"_jrs);
m_moderatorGroup = this->config.get("Moderator"_jrs, "Moderator"_jrs);
m_administratorGroup = this->config.get("Administrator"_jrs, "Administrator"_jrs);
m_lockSteam = this->config.get<bool>("LockSteam"sv, true);
m_lockIP = this->config.get<bool>("LockIP"sv, false);
m_lockName = this->config.get<bool>("LockName"sv, false);
m_kickLockMismatch = this->config.get<bool>("KickLockMismatch"sv, true);
m_autoAuthSteam = this->config.get<bool>("AutoAuthSteam"sv, true);
m_autoAuthIP = this->config.get<bool>("AutoAuthIP"sv, false);
m_atmDefault = this->config.get("ATMDefault"sv);
m_moderatorGroup = this->config.get("Moderator"sv, "Moderator"sv);
m_administratorGroup = this->config.get("Administrator"sv, "Administrator"sv);
ModGroup *group;
Jupiter::ReferenceString dotLockSteam = ".LockSteam";
Jupiter::ReferenceString dotLockIP = ".LockIP";
Jupiter::ReferenceString dotLockName = ".LockName";
Jupiter::ReferenceString dotKickLockMismatch = ".KickLockMismatch";
Jupiter::ReferenceString dotAutoAuthSteam = ".AutoAuthSteam";
Jupiter::ReferenceString dotAutoAuthIP = ".AutoAuthIP";
Jupiter::ReferenceString dotNext = ".Next";
Jupiter::ReferenceString dotAccess = ".Access";
Jupiter::ReferenceString dotPrefix = ".Prefix";
Jupiter::ReferenceString dotGamePrefix = ".GamePrefix";
std::string groupName = this->config.get("Default"_jrs, ""s);
static constexpr std::string_view dotLockSteam = ".LockSteam"sv;
static constexpr std::string_view dotLockIP = ".LockIP"sv;
static constexpr std::string_view dotLockName = ".LockName"sv;
static constexpr std::string_view dotKickLockMismatch = ".KickLockMismatch"sv;
static constexpr std::string_view dotAutoAuthSteam = ".AutoAuthSteam"sv;
static constexpr std::string_view dotAutoAuthIP = ".AutoAuthIP"sv;
static constexpr std::string_view dotNext = ".Next"sv;
static constexpr std::string_view dotAccess = ".Access"sv;
static constexpr std::string_view dotPrefix = ".Prefix"sv;
static constexpr std::string_view dotGamePrefix = ".GamePrefix"sv;
std::string groupName = this->config.get("Default"sv, ""s);
while (!groupName.empty()) {
// Add group
@ -170,7 +169,7 @@ int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &pla
if (!player.uuid.empty()) {
Jupiter::Config *section = this->config.getSection(player.uuid);
if (section != nullptr) {
std::string_view groupName = section->get("Group"_jrs);
std::string_view groupName = section->get("Group"sv);
if (groupName.empty()) {
group = &RenX_ModSystemPlugin::groups.front();
@ -182,10 +181,10 @@ int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &pla
}
auto sectionAuth = [&] {
player.varData[this->name].set("Group"_jrs, group->name);
player.formatNamePrefix = section->get("Prefix"_jrs, group->prefix);
player.gamePrefix = section->get("GamePrefix"_jrs, group->gamePrefix);
player.access = section->get<int>("Access"_jrs, group->access);
player.varData[this->name].set("Group"sv, group->name);
player.formatNamePrefix = section->get("Prefix"sv, group->prefix);
player.gamePrefix = section->get("GamePrefix"sv, group->gamePrefix);
player.access = section->get<int>("Access"sv, group->access);
if (player.access != 0)
{
server.sendMessage(player, string_printf("You are now authenticated with access level %d; group: %.*s.", player.access, group->name.size(), group->name.data()));
@ -197,7 +196,7 @@ int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &pla
server.sendData(string_printf("d%d\n", player.id));
}
}
Jupiter::String playerName = RenX::getFormattedPlayerName(player);
std::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.data(), player.access, group->name.size(), group->name.data());
return player.access;
@ -206,16 +205,16 @@ int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &pla
if (forceAuth)
return sectionAuth();
bool lockSteam_l = section->get<bool>("LockSteam"_jrs, group->lockSteam);
bool lockIP_l = section->get<bool>("LockIP"_jrs, group->lockIP);
bool lockName_l = section->get<bool>("LockName"_jrs, group->lockName);
bool kickLockMismatch_l = section->get<bool>("KickLockMismatch"_jrs, group->kickLockMismatch);
bool autoAuthSteam_l = section->get<bool>("AutoAuthSteam"_jrs, group->autoAuthSteam);
bool autoAuthIP_l = section->get<bool>("AutoAuthIP"_jrs, group->autoAuthIP);
bool lockSteam_l = section->get<bool>("LockSteam"sv, group->lockSteam);
bool lockIP_l = section->get<bool>("LockIP"sv, group->lockIP);
bool lockName_l = section->get<bool>("LockName"sv, group->lockName);
bool kickLockMismatch_l = section->get<bool>("KickLockMismatch"sv, group->kickLockMismatch);
bool autoAuthSteam_l = section->get<bool>("AutoAuthSteam"sv, group->autoAuthSteam);
bool autoAuthIP_l = section->get<bool>("AutoAuthIP"sv, group->autoAuthIP);
uint64_t steamid = Jupiter::from_string<uint64_t>(section->get("SteamID"sv));
std::string_view ip = section->get("LastIP"_jrs);
std::string_view name = section->get("Name"_jrs);
std::string_view ip = section->get("LastIP"sv);
std::string_view name = section->get("Name"sv);
if ((lockSteam_l == false || player.steamid == steamid) && (lockIP_l == false || player.ip == ip) && (lockName_l == false || jessilib::equalsi(player.name, name)))
{
@ -224,14 +223,14 @@ int RenX_ModSystemPlugin::auth(RenX::Server &server, const RenX::PlayerInfo &pla
}
else if (kickLockMismatch_l)
{
server.kickPlayer(player, "Moderator entry lock mismatch"_jrs);
server.kickPlayer(player, "Moderator entry lock mismatch"sv);
return -1;
}
}
}
group = this->getDefaultGroup();
player.varData[this->name].set("Group"_jrs, group->name);
player.varData[this->name].set("Group"sv, group->name);
player.formatNamePrefix = group->prefix;
player.gamePrefix = group->gamePrefix;
return player.access = group->access;
@ -241,7 +240,7 @@ void RenX_ModSystemPlugin::tempAuth(RenX::Server &server, const RenX::PlayerInfo
if (group == nullptr)
group = this->getDefaultGroup();
player.varData[name].set("Group"_jrs, group->name);
player.varData[name].set("Group"sv, group->name);
player.formatNamePrefix = group->prefix;
player.gamePrefix = group->gamePrefix;
player.access = group->access;
@ -251,10 +250,10 @@ void RenX_ModSystemPlugin::tempAuth(RenX::Server &server, const RenX::PlayerInfo
}
bool RenX_ModSystemPlugin::set(RenX::PlayerInfo &player, ModGroup &group) {
bool r = this->config[player.uuid].set("Group"_jrs, group.name);
this->config[player.uuid].set("SteamID"_jrs, static_cast<std::string>(string_printf("%llu", player.steamid)));
this->config[player.uuid].set("LastIP"_jrs, static_cast<std::string>(player.ip));
this->config[player.uuid].set("Name"_jrs, player.name);
bool r = this->config[player.uuid].set("Group"sv, group.name);
this->config[player.uuid].set("SteamID"sv, static_cast<std::string>(string_printf("%llu", player.steamid)));
this->config[player.uuid].set("LastIP"sv, static_cast<std::string>(player.ip));
this->config[player.uuid].set("Name"sv, player.name);
this->config.write();
return r;
@ -299,7 +298,7 @@ int RenX_ModSystemPlugin::getConfigAccess(std::string_view uuid) const {
return RenX_ModSystemPlugin::groups.front().access;
}
return section->get<int>("Access"_jrs, getGroupByName(section->get("Group"_jrs),const_cast<ModGroup *>(&groups.front()))->access);
return section->get<int>("Access"sv, getGroupByName(section->get("Group"sv),const_cast<ModGroup *>(&groups.front()))->access);
}
size_t RenX_ModSystemPlugin::getGroupCount() const {
@ -331,9 +330,9 @@ RenX_ModSystemPlugin::~RenX_ModSystemPlugin() {
if (server->players.size() != server->getBotCount()) {
for (auto node = server->players.begin(); node != server->players.end(); ++node) {
if (node->isBot == false) {
node->varData[RenX_ModSystemPlugin::name].remove("Group"_jrs);
node->gamePrefix.truncate(node->gamePrefix.size());
node->formatNamePrefix.truncate(node->formatNamePrefix.size());
node->varData[RenX_ModSystemPlugin::name].remove("Group"sv);
node->gamePrefix.clear();
node->formatNamePrefix.clear();
if (node->adminType == game_administrator_name)
node->access = 2;
else if (node->adminType == game_moderator_name)
@ -358,9 +357,9 @@ void RenX_ModSystemPlugin::RenX_OnPlayerDelete(RenX::Server &server, const RenX:
if (RenX_ModSystemPlugin::groups.size() != 0 && !player.isBot && !player.uuid.empty()) {
Jupiter::Config *section = this->config.getSection(player.uuid);
if (section != nullptr) {
section->set("SteamID"_jrs, static_cast<std::string>(string_printf("%llu", player.steamid)));
section->set("LastIP"_jrs, static_cast<std::string>(player.ip));
section->set("Name"_jrs, player.name);
section->set("SteamID"sv, static_cast<std::string>(string_printf("%llu", player.steamid)));
section->set("LastIP"sv, static_cast<std::string>(player.ip));
section->set("Name"sv, player.name);
}
}
}
@ -427,7 +426,7 @@ RenX_ModSystemPlugin pluginInstance;
void AuthIRCCommand::create()
{
this->addTrigger("auth"_jrs);
this->addTrigger("auth"sv);
this->setAccessLevel(3);
}
@ -450,32 +449,32 @@ void AuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::str
serverMatch = true;
player = server->getPlayerByPartName(parameters);
if (player == nullptr)
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
else
{
int uAccess = source->getAccessLevel(channel, nick);
int cAccess = pluginInstance.getConfigAccess(player->uuid);
if (cAccess > uAccess && uAccess < static_cast<int>(source->getPrefixes().size()))
source->sendNotice(nick, "Error: Can't authenticate higher level moderators."_jrs);
source->sendNotice(nick, "Error: Can't authenticate higher level moderators."sv);
else if (player->access == cAccess)
source->sendNotice(nick, "Error: Player is already authenticated"_jrs);
source->sendNotice(nick, "Error: Player is already authenticated"sv);
else if (player->access > cAccess)
source->sendNotice(nick, "Error: Player is already temporarily authenticated."_jrs);
source->sendNotice(nick, "Error: Player is already temporarily authenticated."sv);
else
{
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
if (pluginInstance.auth(*server, *player) == -1)
source->sendNotice(nick, "Error: Player failed to pass strict lock checks. Player kicked."_jrs);
else if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"_jrs))
source->sendNotice(nick, "Error: Failed to authenticate player."_jrs);
source->sendNotice(nick, "Error: Player failed to pass strict lock checks. Player kicked."sv);
else if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"sv))
source->sendNotice(nick, "Error: Failed to authenticate player."sv);
else
source->sendNotice(nick, "Player authenticated successfully."_jrs);
source->sendNotice(nick, "Player authenticated successfully."sv);
}
}
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
else
@ -484,7 +483,7 @@ void AuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::str
std::string_view AuthIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Authenticates a player in-game. Syntax: auth [player=you]");
static constexpr std::string_view defaultHelp = "Authenticates a player in-game. Syntax: auth [player=you]"sv;
return defaultHelp;
}
@ -494,10 +493,10 @@ IRC_COMMAND_INIT(AuthIRCCommand)
void DeAuthIRCCommand::create()
{
this->addTrigger("unauth"_jrs);
this->addTrigger("deauth"_jrs);
this->addTrigger("demod"_jrs);
this->addTrigger("dtm"_jrs);
this->addTrigger("unauth"sv);
this->addTrigger("deauth"sv);
this->addTrigger("demod"sv);
this->addTrigger("dtm"sv);
this->setAccessLevel(3);
}
@ -520,22 +519,22 @@ void DeAuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::s
serverMatch = true;
player = server->getPlayerByPartName(parameters);
if (player == nullptr)
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
else
{
int uAccess = source->getAccessLevel(channel, nick);
int cAccess = pluginInstance.getConfigAccess(player->uuid);
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."sv);
else if (pluginInstance.resetAccess(*player))
source->sendNotice(nick, "Player unauthenticated successfully."_jrs);
source->sendNotice(nick, "Player unauthenticated successfully."sv);
else
source->sendNotice(nick, "Error: Player not authenticated."_jrs);
source->sendNotice(nick, "Error: Player not authenticated."sv);
}
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
else
@ -544,7 +543,7 @@ void DeAuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::s
std::string_view DeAuthIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Unauthenticates a player in-game. Syntax: deauth [player=you]");
static constexpr std::string_view defaultHelp = "Unauthenticates a player in-game. Syntax: deauth [player=you]"sv;
return defaultHelp;
}
@ -554,7 +553,7 @@ IRC_COMMAND_INIT(DeAuthIRCCommand)
void ATMIRCCommand::create()
{
this->addTrigger("atm"_jrs);
this->addTrigger("atm"sv);
this->setAccessLevel(3);
}
@ -577,7 +576,7 @@ void ATMIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
int index = Jupiter::asInt(parameters_split.first);
if (index < 0 || index >= static_cast<int>(pluginInstance.groups.size())) {
source->sendNotice(nick, "Warning: Invalid group index. Ingoring parameter..."_jrs);
source->sendNotice(nick, "Warning: Invalid group index. Ingoring parameter..."sv);
}
else if (index == 0) {
source->sendNotice(nick, "Error: Default group is not valid for this command. Use \"deauth\" to deauthorize a player."sv);
@ -596,7 +595,7 @@ void ATMIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
}
}
if (group == nullptr)
source->sendNotice(nick, "Error: Invalid group."_jrs);
source->sendNotice(nick, "Error: Invalid group."sv);
else
{
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
@ -607,18 +606,18 @@ void ATMIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
serverMatch = true;
player = server->getPlayerByPartName(playerName);
if (player == nullptr)
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
else if (player->access > group->access)
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."sv);
else
{
pluginInstance.tempAuth(*server, *player, group);
source->sendNotice(nick, "Player successfully temporarily authenticated."_jrs);
source->sendNotice(nick, "Player successfully temporarily authenticated."sv);
}
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
}
@ -626,7 +625,7 @@ void ATMIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
std::string_view ATMIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Temporarily authenticates a player in-game. Syntax: atm [level] [player=you]");
static constexpr std::string_view defaultHelp = "Temporarily authenticates a player in-game. Syntax: atm [level] [player=you]"sv;
return defaultHelp;
}
@ -636,16 +635,16 @@ IRC_COMMAND_INIT(ATMIRCCommand)
void AddIRCCommand::create()
{
this->addTrigger("addmod"_jrs);
this->addTrigger("add"_jrs);
this->addTrigger("set"_jrs);
this->addTrigger("addmod"sv);
this->addTrigger("add"sv);
this->addTrigger("set"sv);
this->setAccessLevel(5);
}
void AddIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters) {
auto parameters_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (parameters_split.second.empty()) {
source->sendNotice(nick, "Error: Too few parameters. Syntax: add <level> <player>"_jrs);
source->sendNotice(nick, "Error: Too few parameters. Syntax: add <level> <player>"sv);
return;
}
@ -662,7 +661,7 @@ void AddIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
int index = Jupiter::asInt(parameters_split.first);
if (index < 0 || index >= static_cast<int>(pluginInstance.groups.size())) {
source->sendNotice(nick, "Error: Invalid group index."_jrs);
source->sendNotice(nick, "Error: Invalid group index."sv);
}
else {
group = pluginInstance.getGroupByIndex(index);
@ -670,7 +669,7 @@ void AddIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
}
}
if (group == nullptr)
source->sendNotice(nick, "Error: Invalid group."_jrs);
source->sendNotice(nick, "Error: Invalid group."sv);
else {
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) {
server = RenX::getCore()->getServer(i);
@ -678,11 +677,11 @@ void AddIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
serverMatch = true;
player = server->getPlayerByPartName(playerName);
if (player == nullptr)
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
else if (player->isBot)
source->sendNotice(nick, "Error: A bot can not be a moderator."_jrs);
source->sendNotice(nick, "Error: A bot can not be a moderator."sv);
else if (player->uuid.empty())
source->sendNotice(nick, "Error: Player has no UUID."_jrs);
source->sendNotice(nick, "Error: Player has no UUID."sv);
else {
pluginInstance.resetAccess(*player);
if (pluginInstance.set(*player, *group))
@ -694,14 +693,14 @@ void AddIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
}
std::string_view AddIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Adds a player to the in-game moderator list. Syntax: add <level> <player>");
static constexpr std::string_view defaultHelp = "Adds a player to the in-game moderator list. Syntax: add <level> <player>"sv;
return defaultHelp;
}
@ -711,10 +710,10 @@ IRC_COMMAND_INIT(AddIRCCommand)
void DelIRCCommand::create()
{
this->addTrigger("delmod"_jrs);
this->addTrigger("remmod"_jrs);
this->addTrigger("del"_jrs);
this->addTrigger("rem"_jrs);
this->addTrigger("delmod"sv);
this->addTrigger("remmod"sv);
this->addTrigger("del"sv);
this->addTrigger("rem"sv);
this->setAccessLevel(5);
}
@ -722,7 +721,7 @@ void DelIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
{
std::string_view parameters_view = parameters;
if (parameters.empty())
source->sendNotice(nick, "Error: Too few parameters. Syntax: del <player>"_jrs);
source->sendNotice(nick, "Error: Too few parameters. Syntax: del <player>"sv);
else
{
Jupiter::IRC::Client::Channel *chan = source->getChannel(channel);
@ -742,43 +741,43 @@ void DelIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::stri
if (player == nullptr)
{
if (pluginInstance.removeModSection(parameters))
source->sendNotice(nick, "Player has been removed from the moderator list."_jrs);
source->sendNotice(nick, "Player has been removed from the moderator list."sv);
else
{
for (auto& section : pluginInstance.getConfig().getSections())
{
if (jessilib::equalsi(section.second.get("Name"_jrs), parameters_view)) {
if (jessilib::equalsi(section.second.get("Name"sv), parameters_view)) {
if (pluginInstance.removeModSection(section.first))
source->sendNotice(nick, "Player has been removed from the moderator list."_jrs);
source->sendNotice(nick, "Player has been removed from the moderator list."sv);
else
source->sendNotice(nick, "Error: Unknown error occurred."_jrs);
source->sendNotice(nick, "Error: Unknown error occurred."sv);
return;
}
}
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
}
}
else if (player->isBot)
source->sendNotice(nick, "Error: A bot can not be a moderator."_jrs);
source->sendNotice(nick, "Error: A bot can not be a moderator."sv);
else if (pluginInstance.removeModSection(player->uuid))
source->sendNotice(nick, "Player has been removed from the moderator list."_jrs);
source->sendNotice(nick, "Player has been removed from the moderator list."sv);
else
source->sendNotice(nick, "Player is not in the moderator list."_jrs);
source->sendNotice(nick, "Player is not in the moderator list."sv);
break;
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
}
std::string_view DelIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Removes a player from the in-game moderator list. Syntax: del <player>");
static constexpr std::string_view defaultHelp = "Removes a player from the in-game moderator list. Syntax: del <player>"sv;
return defaultHelp;
}
@ -788,8 +787,8 @@ IRC_COMMAND_INIT(DelIRCCommand)
void ForceAuthIRCCommand::create()
{
this->addTrigger("fauth"_jrs);
this->addTrigger("forceauth"_jrs);
this->addTrigger("fauth"sv);
this->addTrigger("forceauth"sv);
this->setAccessLevel(4);
}
@ -812,31 +811,31 @@ void ForceAuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std
serverMatch = true;
player = server->getPlayerByPartName(parameters);
if (player == nullptr)
source->sendNotice(nick, "Error: Player not found."_jrs);
source->sendNotice(nick, "Error: Player not found."sv);
else
{
int uAccess = source->getAccessLevel(channel, nick);
int cAccess = pluginInstance.getConfigAccess(player->uuid);
if (cAccess > uAccess && uAccess < static_cast<int>(source->getPrefixes().size()))
source->sendNotice(nick, "Error: Can't authenticate higher level moderators."_jrs);
source->sendNotice(nick, "Error: Can't authenticate higher level moderators."sv);
else if (player->access == cAccess)
source->sendNotice(nick, "Error: Player is already authenticated"_jrs);
source->sendNotice(nick, "Error: Player is already authenticated"sv);
else if (player->access > cAccess)
source->sendNotice(nick, "Error: Player is already temporarily authenticated."_jrs);
source->sendNotice(nick, "Error: Player is already temporarily authenticated."sv);
else
{
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
pluginInstance.auth(*server, *player, false, true);
if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"_jrs))
source->sendNotice(nick, "Error: Failed to authenticate player."_jrs);
if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"sv))
source->sendNotice(nick, "Error: Failed to authenticate player."sv);
else
source->sendNotice(nick, "Player authenticated successfully."_jrs);
source->sendNotice(nick, "Player authenticated successfully."sv);
}
}
}
}
if (serverMatch == false)
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
}
}
else
@ -845,7 +844,7 @@ void ForceAuthIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std
std::string_view ForceAuthIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Forcefully authenticates a player in-game. Syntax: auth [player=you]");
static constexpr std::string_view defaultHelp = "Forcefully authenticates a player in-game. Syntax: auth [player=you]"sv;
return defaultHelp;
}
@ -854,12 +853,12 @@ IRC_COMMAND_INIT(ForceAuthIRCCommand)
// ModList IRC Command
void ModListIRCCommand::create() {
this->addTrigger("modlist"_jrs);
this->addTrigger("mlist"_jrs);
this->addTrigger("modlist"sv);
this->addTrigger("mlist"sv);
}
void ModListIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters) {
Jupiter::String msg;
std::string msg;
size_t msgBaseSize;
bool haveMods = false;
for (auto node = pluginInstance.groups.begin(); node != pluginInstance.groups.end(); ++node) {
@ -869,24 +868,25 @@ void ModListIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::
msgBaseSize = msg.size();
for (auto& section : pluginInstance.getConfig().getSections()) {
if (jessilib::equalsi(section.second.get("Group"_jrs), node->name)) {
msg += section.second.get("Name"_jrs, section.second.getName());
msg += ", "_jrs;
if (jessilib::equalsi(section.second.get("Group"sv), node->name)) {
msg += section.second.get("Name"sv, section.second.getName());
msg += ", "sv;
}
}
if (msg.size() != msgBaseSize) {
msg.truncate(2);
msg.pop_back(); // ' '
msg.pop_back(); // ','
source->sendMessage(channel, msg);
haveMods = true;
}
}
if (!haveMods)
source->sendMessage(channel, "There are no configured moderators."_jrs);
source->sendMessage(channel, "There are no configured moderators."sv);
}
std::string_view ModListIRCCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays the moderator list. Syntax: modlist");
static constexpr std::string_view defaultHelp = "Displays the moderator list. Syntax: modlist"sv;
return defaultHelp;
}
@ -898,7 +898,7 @@ IRC_COMMAND_INIT(ModListIRCCommand)
void AuthGameCommand::create()
{
this->addTrigger("auth"_jrs);
this->addTrigger("auth"sv);
this->setAccessLevel(3);
}
@ -908,37 +908,37 @@ void AuthGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
{
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr)
source->sendMessage(*player, "Error: Player not found."_jrs);
source->sendMessage(*player, "Error: Player not found."sv);
else if (target == player)
source->sendMessage(*player, "Error: You can not authenticate yourself."_jrs);
source->sendMessage(*player, "Error: You can not authenticate yourself."sv);
else
{
int cAccess = pluginInstance.getConfigAccess(target->uuid);
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."sv);
else if (target->access == cAccess)
source->sendMessage(*player, "Error: Player is already authenticated"_jrs);
source->sendMessage(*player, "Error: Player is already authenticated"sv);
else if (target->access > cAccess)
source->sendMessage(*player, "Error: Player is already temporarily authenticated."_jrs);
source->sendMessage(*player, "Error: Player is already temporarily authenticated."sv);
else
{
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
if (pluginInstance.auth(*source, *player) == -1)
source->sendMessage(*player, "Error: Player failed to pass strict lock checks. Player kicked."_jrs);
else if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"_jrs))
source->sendMessage(*player, "Error: Failed to authenticate player."_jrs);
source->sendMessage(*player, "Error: Player failed to pass strict lock checks. Player kicked."sv);
else if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"sv))
source->sendMessage(*player, "Error: Failed to authenticate player."sv);
else
source->sendMessage(*player, "Player authenticated successfully."_jrs);
source->sendMessage(*player, "Player authenticated successfully."sv);
}
}
}
else
source->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"_jrs);
source->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"sv);
}
std::string_view AuthGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Authenticates a player. Syntax: auth <player>");
static constexpr std::string_view defaultHelp = "Authenticates a player. Syntax: auth <player>"sv;
return defaultHelp;
}
@ -948,7 +948,7 @@ GAME_COMMAND_INIT(AuthGameCommand)
void ATMGameCommand::create()
{
this->addTrigger("atm"_jrs);
this->addTrigger("atm"sv);
this->setAccessLevel(3);
}
@ -963,17 +963,17 @@ void ATMGameCommand::trigger(RenX::Server *server, RenX::PlayerInfo *player, std
int index = Jupiter::asInt(parameters_split.first);
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..."sv);
}
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."sv);
return;
}
else {
group = pluginInstance.getGroupByIndex(index);
if (group->access > player->access) {
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..."sv);
}
playerName = parameters_split.second;
}
@ -981,25 +981,25 @@ void ATMGameCommand::trigger(RenX::Server *server, RenX::PlayerInfo *player, std
if (group != nullptr) {
target = server->getPlayerByPartName(playerName);
if (target == nullptr)
server->sendMessage(*player, "Error: Player not found."_jrs);
server->sendMessage(*player, "Error: Player not found."sv);
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."sv);
else
{
pluginInstance.tempAuth(*server, *target, group);
server->sendMessage(*player, "Player successfully temporarily authenticated."_jrs);
server->sendMessage(*player, "Player successfully temporarily authenticated."sv);
}
}
else
server->sendMessage(*player, "Error: Invalid group."_jrs);
server->sendMessage(*player, "Error: Invalid group."sv);
}
else
server->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"_jrs);
server->sendMessage(*player, "Error: Too few parameters. Syntax: auth <player>"sv);
}
std::string_view ATMGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Temporarily authenticates a player. Syntax: atm [level] <player>");
static constexpr std::string_view defaultHelp = "Temporarily authenticates a player. Syntax: atm [level] <player>"sv;
return defaultHelp;
}
@ -1009,8 +1009,8 @@ GAME_COMMAND_INIT(ATMGameCommand)
void ForceAuthGameCommand::create()
{
this->addTrigger("fauth"_jrs);
this->addTrigger("forceauth"_jrs);
this->addTrigger("fauth"sv);
this->addTrigger("forceauth"sv);
this->setAccessLevel(4);
}
@ -1020,36 +1020,36 @@ void ForceAuthGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *playe
{
RenX::PlayerInfo *target = source->getPlayerByPartName(parameters);
if (target == nullptr)
source->sendMessage(*player, "Error: Player not found."_jrs);
source->sendMessage(*player, "Error: Player not found."sv);
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."sv);
else
{
int cAccess = pluginInstance.getConfigAccess(target->uuid);
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."sv);
else if (target->access == cAccess)
source->sendMessage(*player, "Error: Player is already authenticated"_jrs);
source->sendMessage(*player, "Error: Player is already authenticated"sv);
else if (target->access > cAccess)
source->sendMessage(*player, "Error: Player is already temporarily authenticated."_jrs);
source->sendMessage(*player, "Error: Player is already temporarily authenticated."sv);
else
{
RenX_ModSystemPlugin::ModGroup *defaultGroup = pluginInstance.getDefaultGroup();
pluginInstance.auth(*source, *player, false, true);
if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"_jrs))
source->sendMessage(*player, "Error: Failed to authenticate player."_jrs);
if (defaultGroup->name == player->varData[pluginInstance.getName()].get("Group"sv))
source->sendMessage(*player, "Error: Failed to authenticate player."sv);
else
source->sendMessage(*player, "Player authenticated successfully."_jrs);
source->sendMessage(*player, "Player authenticated successfully."sv);
}
}
}
else
source->sendMessage(*player, "Error: Too few parameters. Syntax: fauth <player>"_jrs);
source->sendMessage(*player, "Error: Too few parameters. Syntax: fauth <player>"sv);
}
std::string_view ForceAuthGameCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Forcefully authenticates a player. Syntax: fauth <player>");
static constexpr std::string_view defaultHelp = "Forcefully authenticates a player. Syntax: fauth <player>"sv;
return defaultHelp;
}

2
src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.h

@ -21,8 +21,6 @@
#include <list>
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/String.hpp"
#include "IRC_Command.h"
#include "RenX_Plugin.h"
#include "RenX_GameCommand.h"

3
src/Plugins/RenX/RenX.NicknameUUID/RenX_NicknameUUID.cpp

@ -16,14 +16,13 @@
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include "Jupiter/String.hpp"
#include "RenX_Core.h"
#include "RenX_Server.h"
#include "RenX_PlayerInfo.h"
#include "RenX_Functions.h"
#include "RenX_NicknameUUID.h"
Jupiter::StringS calc_uuid(RenX::PlayerInfo &player)
std::string calc_uuid(RenX::PlayerInfo &player)
{
return player.name;
}

1
src/Plugins/RenX/RenX.NicknameUUID/RenX_NicknameUUID.h

@ -20,7 +20,6 @@
#define _RENX_NICKNAMEUUID_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_NicknameUUIDPlugin : public RenX::Plugin

1
src/Plugins/RenX/RenX.Plugin.Template/Example.h

@ -10,7 +10,6 @@
#define _EXAMPLE_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_TPlugin : public RenX::Plugin

34
src/Plugins/RenX/RenX.Relay/RenX_Relay.cpp

@ -11,6 +11,7 @@
#include <unordered_set>
#include <cassert>
#include <fstream>
#include <iostream>
#include "fmt/format.h" // TODO: replace with <format> later
#include <charconv>
#include "jessilib/split.hpp"
@ -23,7 +24,6 @@
// String literal redefinition of RenX::DelimC
#define RX_DELIM "\x02"
using namespace Jupiter::literals;
using namespace std::literals;
constexpr const char g_blank_steamid[] = "0x0000000000000000";
constexpr std::chrono::steady_clock::duration g_reconnect_delay = std::chrono::seconds{15 }; // game server: 120s
@ -178,7 +178,7 @@ bool RenX_RelayPlugin::initialize() {
m_default_settings = get_settings(config);
std::string_view upstreams_list = config.get("Upstreams"_jrs, ""sv);
std::string_view upstreams_list = config.get("Upstreams"sv, ""sv);
std::vector<std::string_view> upstream_names = jessilib::word_split_view(upstreams_list, WHITESPACE_SV);
for (auto upstream_name : upstream_names) {
auto upstream_config = config.getSection(upstream_name);
@ -325,7 +325,7 @@ void RenX_RelayPlugin::RenX_OnRaw(RenX::Server &server, std::string_view line) {
// This is a command response for an upstream command; this is only relevant to one server: that server
// Always echo the command back exactly as it was sent
Jupiter::StringS line_sanitized;
std::string line_sanitized;
const auto& rcon_username = get_upstream_rcon_username(*front_server_info, server);
if (rcon_username == server.getRCONUsername()) {
// No need to recombine tokens
@ -556,20 +556,20 @@ RenX_RelayPlugin::upstream_settings RenX_RelayPlugin::get_settings(const Jupiter
upstream_settings result{};
// Read in settings
result.m_upstream_hostname = in_config.get<std::string>("UpstreamHost"_jrs, m_default_settings.m_upstream_hostname);
result.m_upstream_port = in_config.get<uint16_t>("UpstreamPort"_jrs, m_default_settings.m_upstream_port);
result.m_rcon_username = in_config.get<std::string>("RconUsername"_jrs, m_default_settings.m_rcon_username);
result.m_log_traffic = in_config.get<bool>("LogTraffic"_jrs, m_default_settings.m_log_traffic);
result.m_fake_pings = in_config.get<bool>("FakePings"_jrs, m_default_settings.m_fake_pings);
result.m_fake_ignored_commands = in_config.get<bool>("FakeSuppressedCommands"_jrs, m_default_settings.m_fake_ignored_commands);
result.m_sanitize_names = in_config.get<bool>("SanitizeNames"_jrs, m_default_settings.m_sanitize_names);
result.m_sanitize_ips = in_config.get<bool>("SanitizeIPs"_jrs, m_default_settings.m_sanitize_ips);
result.m_sanitize_hwids = in_config.get<bool>("SanitizeHWIDs"_jrs, m_default_settings.m_sanitize_hwids);
result.m_sanitize_steam_ids = in_config.get<bool>("SanitizeSteamIDs"_jrs, m_default_settings.m_sanitize_steam_ids);
result.m_suppress_unknown_commands = in_config.get<bool>("SuppressUnknownCmds"_jrs, m_default_settings.m_suppress_unknown_commands);
result.m_suppress_blacklisted_commands = in_config.get<bool>("SuppressBlacklistedCmds"_jrs, m_default_settings.m_suppress_blacklisted_commands);
result.m_suppress_chat_logs = in_config.get<bool>("SuppressChatLogs"_jrs, m_default_settings.m_suppress_chat_logs);
result.m_suppress_rcon_command_logs = in_config.get<bool>("SuppressRconCommandLogs"_jrs, m_default_settings.m_suppress_rcon_command_logs);
result.m_upstream_hostname = in_config.get<std::string>("UpstreamHost"sv, m_default_settings.m_upstream_hostname);
result.m_upstream_port = in_config.get<uint16_t>("UpstreamPort"sv, m_default_settings.m_upstream_port);
result.m_rcon_username = in_config.get<std::string>("RconUsername"sv, m_default_settings.m_rcon_username);
result.m_log_traffic = in_config.get<bool>("LogTraffic"sv, m_default_settings.m_log_traffic);
result.m_fake_pings = in_config.get<bool>("FakePings"sv, m_default_settings.m_fake_pings);
result.m_fake_ignored_commands = in_config.get<bool>("FakeSuppressedCommands"sv, m_default_settings.m_fake_ignored_commands);
result.m_sanitize_names = in_config.get<bool>("SanitizeNames"sv, m_default_settings.m_sanitize_names);
result.m_sanitize_ips = in_config.get<bool>("SanitizeIPs"sv, m_default_settings.m_sanitize_ips);
result.m_sanitize_hwids = in_config.get<bool>("SanitizeHWIDs"sv, m_default_settings.m_sanitize_hwids);
result.m_sanitize_steam_ids = in_config.get<bool>("SanitizeSteamIDs"sv, m_default_settings.m_sanitize_steam_ids);
result.m_suppress_unknown_commands = in_config.get<bool>("SuppressUnknownCmds"sv, m_default_settings.m_suppress_unknown_commands);
result.m_suppress_blacklisted_commands = in_config.get<bool>("SuppressBlacklistedCmds"sv, m_default_settings.m_suppress_blacklisted_commands);
result.m_suppress_chat_logs = in_config.get<bool>("SuppressChatLogs"sv, m_default_settings.m_suppress_chat_logs);
result.m_suppress_rcon_command_logs = in_config.get<bool>("SuppressRconCommandLogs"sv, m_default_settings.m_suppress_rcon_command_logs);
// Populate fake command handlers
if (result.m_fake_pings) {

1
src/Plugins/RenX/RenX.Relay/RenX_Relay.h

@ -10,7 +10,6 @@
#include <deque>
#include <functional>
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/TCPSocket.h"
#include "RenX_Plugin.h"

161
src/Plugins/RenX/RenX.ServerList/RenX_ServerList.cpp

@ -17,6 +17,7 @@
*/
#include "jessilib/split.hpp"
#include "jessilib/unicode.hpp"
#include "Jupiter/IRC_Client.h"
#include "Jupiter/HTTP.h"
#include "Jupiter/HTTP_QueryString.h"
@ -27,10 +28,9 @@
#include "RenX_PlayerInfo.h"
#include "RenX_ServerList.h"
using namespace Jupiter::literals;
using namespace std::literals;
static STRING_LITERAL_AS_NAMED_REFERENCE(CONTENT_TYPE_APPLICATION_JSON, "application/json");
static constexpr std::string_view CONTENT_TYPE_APPLICATION_JSON = "application/json"sv;
constexpr std::string_view server_list_game_header = "<html><body>"sv;
constexpr std::string_view server_list_game_footer = "\n</body></html>"sv;
@ -94,13 +94,13 @@ std::string jsonify(std::string_view in_str) {
}
bool RenX_ServerListPlugin::initialize() {
m_web_hostname = this->config.get("Hostname"_jrs, ""_jrs);
m_web_path = this->config.get("Path"_jrs, "/"_jrs);
m_server_list_page_name = this->config.get("ServersPageName"_jrs, "servers"_jrs);
m_server_list_long_page_name = this->config.get("HumanServersPageName"_jrs, "servers_long"_jrs);
m_server_page_name = this->config.get("ServerPageName"_jrs, "server"_jrs);
m_metadata_page_name = this->config.get("MetadataPageName"_jrs, "metadata"_jrs);
m_metadata_prometheus_page_name = this->config.get("MetadataPrometheusPageName"_jrs, "metadata_prometheus"_jrs);
m_web_hostname = this->config.get("Hostname"sv, ""sv);
m_web_path = this->config.get("Path"sv, "/"sv);
m_server_list_page_name = this->config.get("ServersPageName"sv, "servers"sv);
m_server_list_long_page_name = this->config.get("HumanServersPageName"sv, "servers_long"sv);
m_server_page_name = this->config.get("ServerPageName"sv, "server"sv);
m_metadata_page_name = this->config.get("MetadataPageName"sv, "metadata"sv);
m_metadata_prometheus_page_name = this->config.get("MetadataPrometheusPageName"sv, "metadata_prometheus"sv);
/** Initialize content */
Jupiter::HTTP::Server &server = getHTTPServer();
@ -184,16 +184,16 @@ std::string RenX_ServerListPlugin::server_as_json(const RenX::Server &server) {
return "null"s;
}
Jupiter::String server_name = jsonify(server.getName());
Jupiter::String server_map = jsonify(server.getMap().name);
Jupiter::String server_version = jsonify(server.getGameVersion());
Jupiter::ReferenceString server_hostname = serverInfo.hostname;
std::string server_name = jsonify(server.getName());
std::string server_map = jsonify(server.getMap().name);
std::string server_version = jsonify(server.getGameVersion());
std::string_view server_hostname = serverInfo.hostname;
unsigned short server_port = serverInfo.port;
Jupiter::String server_prefix = jsonify(serverInfo.namePrefix);
std::string server_prefix = jsonify(serverInfo.namePrefix);
// Some members we only include if they're populated
if (!server_prefix.empty()) {
server_prefix = R"json("NamePrefix":")json"s + server_prefix + "\","_jrs;
server_prefix = jessilib::join<std::string>(R"json("NamePrefix":")json"sv, server_prefix, "\","sv);
}
std::string server_attributes;
@ -249,20 +249,20 @@ std::string RenX_ServerListPlugin::server_as_server_details_json(const RenX::Ser
// Levels
if (server.maps.size() != 0) {
server_json_block += "\"Levels\":["_jrs;
server_json_block += "\"Levels\":["sv;
server_json_block += "{\"Name\":\""_jrs;
server_json_block += "{\"Name\":\""sv;
server_json_block += jsonify(server.maps[0].name);
server_json_block += "\",\"GUID\":\""_jrs;
server_json_block += "\",\"GUID\":\""sv;
server_json_block += RenX::formatGUID(server.maps[0]);
server_json_block += "\"}"_jrs;
server_json_block += "\"}"sv;
for (size_t index = 1; index != server.maps.size(); ++index) {
server_json_block += ",{\"Name\":\""_jrs;
server_json_block += ",{\"Name\":\""sv;
server_json_block += jsonify(server.maps[index].name);
server_json_block += "\",\"GUID\":\""_jrs;
server_json_block += "\",\"GUID\":\""sv;
server_json_block += RenX::formatGUID(server.maps[index]);
server_json_block += "\"}"_jrs;
server_json_block += "\"}"sv;
}
server_json_block += ']';
@ -271,17 +271,17 @@ std::string RenX_ServerListPlugin::server_as_server_details_json(const RenX::Ser
// Mutators
if (server.mutators.size() != 0) {
if (server.maps.size() != 0)
server_json_block += ","_jrs;
server_json_block += "\"Mutators\":["_jrs;
server_json_block += ","sv;
server_json_block += "\"Mutators\":["sv;
server_json_block += "{\"Name\":\""_jrs;
server_json_block += "{\"Name\":\""sv;
server_json_block += jsonify(server.mutators[0]);
server_json_block += "\"}"_jrs;
server_json_block += "\"}"sv;
for (size_t index = 1; index != server.mutators.size(); ++index) {
server_json_block += ",{\"Name\":\""_jrs;
server_json_block += ",{\"Name\":\""sv;
server_json_block += jsonify(server.mutators[index]);
server_json_block += "\"}"_jrs;
server_json_block += "\"}"sv;
}
server_json_block += ']';
@ -289,35 +289,35 @@ std::string RenX_ServerListPlugin::server_as_server_details_json(const RenX::Ser
// Player List
if (server.players.size() != 0 && server.players.size() != server.getBotCount()) {
server_json_block += ",\"PlayerList\":["_jrs;
server_json_block += ",\"PlayerList\":["sv;
auto node = server.players.begin();
if (node != server.players.end()) {
server_json_block += "{\"Name\":\""_jrs;
server_json_block += "{\"Name\":\""sv;
server_json_block += jsonify(node->name);
server_json_block += "\", \"isBot\":"_jrs;
server_json_block += "\", \"isBot\":"sv;
server_json_block += json_bool_as_cstring(node->isBot);
server_json_block += ", \"Team\":"_jrs;
server_json_block += ", \"Team\":"sv;
server_json_block += std::to_string(static_cast<int>(node->team));
server_json_block += "}"_jrs;
server_json_block += "}"sv;
++node;
}
while (node != server.players.end()) {
server_json_block += ",{\"Name\":\""_jrs;
server_json_block += ",{\"Name\":\""sv;
server_json_block += jsonify(node->name);
server_json_block += "\", \"isBot\":"_jrs;
server_json_block += "\", \"isBot\":"sv;
server_json_block += json_bool_as_cstring(node->isBot);
server_json_block += ", \"Team\":"_jrs;
server_json_block += ", \"Team\":"sv;
server_json_block += std::to_string(static_cast<int>(node->team));
server_json_block += "}"_jrs;
server_json_block += "}"sv;
++node;
}
server_json_block += "]"_jrs;
server_json_block += "]"sv;
}
server_json_block += '}';
@ -327,12 +327,12 @@ std::string RenX_ServerListPlugin::server_as_server_details_json(const RenX::Ser
std::string RenX_ServerListPlugin::server_as_long_json(const RenX::Server &server) {
ListServerInfo serverInfo = getListServerInfo(server);
Jupiter::String server_name = jsonify(server.getName());
Jupiter::String server_map = jsonify(server.getMap().name);
Jupiter::String server_version = jsonify(server.getGameVersion());
Jupiter::ReferenceString server_hostname = serverInfo.hostname;
std::string server_name = jsonify(server.getName());
std::string server_map = jsonify(server.getMap().name);
std::string server_version = jsonify(server.getGameVersion());
std::string_view server_hostname = serverInfo.hostname;
unsigned short server_port = serverInfo.port;
Jupiter::String server_prefix = jsonify(serverInfo.namePrefix);
std::string server_prefix = jsonify(serverInfo.namePrefix);
std::vector<const RenX::PlayerInfo*> activePlayers = server.activePlayers(false);
std::string server_attributes = "[]";
@ -403,72 +403,72 @@ std::string RenX_ServerListPlugin::server_as_long_json(const RenX::Server &serve
// Level Rotation
if (server.maps.size() != 0) {
server_json_block += ",\n\t\t\"Levels\": ["_jrs;
server_json_block += ",\n\t\t\"Levels\": ["sv;
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\": \""sv;
server_json_block += jsonify(server.maps[0].name);
server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs;
server_json_block += "\",\n\t\t\t\t\"GUID\": \""sv;
server_json_block += RenX::formatGUID(server.maps[0]);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
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\": \""sv;
server_json_block += jsonify(server.maps[index].name);
server_json_block += "\",\n\t\t\t\t\"GUID\": \""_jrs;
server_json_block += "\",\n\t\t\t\t\"GUID\": \""sv;
server_json_block += RenX::formatGUID(server.maps[index]);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
}
server_json_block += "\n\t\t]"_jrs;
server_json_block += "\n\t\t]"sv;
}
// Mutators
if (server.mutators.size() != 0) {
server_json_block += ",\n\t\t\"Mutators\": ["_jrs;
server_json_block += ",\n\t\t\"Mutators\": ["sv;
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\": \""sv;
server_json_block += jsonify(server.mutators[0]);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
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\": \""sv;
server_json_block += jsonify(server.mutators[index]);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
}
server_json_block += "\n\t\t]"_jrs;
server_json_block += "\n\t\t]"sv;
}
// Player List
if (activePlayers.size() != 0) {
server_json_block += ",\n\t\t\"PlayerList\": ["_jrs;
server_json_block += ",\n\t\t\"PlayerList\": ["sv;
auto node = activePlayers.begin();
// Add first player to JSON
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\": \""sv;
server_json_block += jsonify((*node)->name);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
++node;
// Add remaining players to JSON
while (node != activePlayers.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\": \""sv;
server_json_block += jsonify((*node)->name);
server_json_block += "\"\n\t\t\t}"_jrs;
server_json_block += "\"\n\t\t\t}"sv;
++node;
}
server_json_block += "\n\t\t]"_jrs;
server_json_block += "\n\t\t]"sv;
}
server_json_block += "\n\t}"_jrs;
server_json_block += "\n\t}"sv;
return static_cast<std::string>(server_json_block);
}
void RenX_ServerListPlugin::addServerToServerList(RenX::Server &server) {
Jupiter::String server_json_block(256);
std::string server_json_block;
// append to server_list_json
server_json_block = server_as_json(server);
@ -481,7 +481,6 @@ void RenX_ServerListPlugin::addServerToServerList(RenX::Server &server) {
}
m_server_list_json += server_json_block;
m_server_list_json += ']';
server_json_block.clear();
// Also update metadata so it reflects the now added server
updateMetadata();
@ -543,23 +542,23 @@ void RenX_ServerListPlugin::updateMetadata() {
}
void RenX_ServerListPlugin::markDetailsStale(RenX::Server& in_server) {
in_server.varData[this->name].remove("j"_jrs);
in_server.varData[this->name].remove("j"sv);
}
void RenX_ServerListPlugin::touchDetails(RenX::Server& in_server) {
auto& server_varData = in_server.varData[this->name];
if (server_varData.get("j"_jrs).empty()) {
if (server_varData.get("j"sv).empty()) {
auto server_json_block = server_as_server_details_json(in_server);
server_varData.set("j"_jrs, server_json_block);
server_varData.set("j"sv, server_json_block);
}
}
std::string_view RenX_ServerListPlugin::getListServerAddress(const RenX::Server& server) {
Jupiter::ReferenceString serverHostname;
std::string_view serverHostname;
serverHostname = server.getSocketHostname();
if (auto section = config.getSection(serverHostname)) {
serverHostname = section->get("ListAddress"_jrs, serverHostname);
serverHostname = section->get("ListAddress"sv, serverHostname);
}
return serverHostname;
@ -573,12 +572,12 @@ RenX_ServerListPlugin::ListServerInfo RenX_ServerListPlugin::getListServerInfo(c
return;
}
result.hostname = section->get("ListAddress"_jrs, result.hostname);
result.port = section->get("ListPort"_jrs, result.port);
result.namePrefix = section->get("ListNamePrefix"_jrs, result.namePrefix);
result.hostname = section->get("ListAddress"sv, result.hostname);
result.port = section->get("ListPort"sv, result.port);
result.namePrefix = section->get("ListNamePrefix"sv, result.namePrefix);
// Attributes
std::string_view attributes_str = section->get("ListAttributes"_jrs);
std::string_view attributes_str = section->get("ListAttributes"sv);
if (!attributes_str.empty()) {
result.attributes = jessilib::split_view(attributes_str, ' ');
}
@ -641,12 +640,12 @@ std::string* handle_server_list_long_page(std::string_view) {
// regenerate server_list_json
*server_list_long_json = "["_jrs;
*server_list_long_json = "["sv;
while (index != servers.size()) {
server = servers[index];
if (server->isConnected() && server->isFullyConnected()) {
*server_list_long_json += "\n\t"_jrs;
*server_list_long_json += "\n\t"sv;
*server_list_long_json += pluginInstance.server_as_long_json(*server);
++index;
break;
@ -656,20 +655,20 @@ std::string* handle_server_list_long_page(std::string_view) {
while (index != servers.size()) {
server = servers[index];
if (server->isConnected() && server->isFullyConnected()) {
*server_list_long_json += ",\n\t"_jrs;
*server_list_long_json += ",\n\t"sv;
*server_list_long_json += pluginInstance.server_as_long_json(*server);
}
++index;
}
*server_list_long_json += "\n]"_jrs;
*server_list_long_json += "\n]"sv;
return server_list_long_json;
}
std::string* handle_server_page(std::string_view query_string) {
Jupiter::HTTP::HTMLFormResponse html_form_response(query_string);
Jupiter::ReferenceString address;
std::string_view address;
int port = 0;
RenX::Server *server;
@ -700,7 +699,7 @@ std::string* handle_server_page(std::string_view query_string) {
// return server data
pluginInstance.touchDetails(*server);
return new std::string(server->varData[pluginInstance.getName()].get("j"_jrs));
return new std::string(server->varData[pluginInstance.getName()].get("j"sv));
}
std::string* handle_metadata_page(std::string_view) {

5
src/Plugins/RenX/RenX.ServerList/RenX_ServerList.h

@ -20,16 +20,15 @@
#define _RENX_SERVERLIST_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_ServerListPlugin : public RenX::Plugin
{
public: // RenX_ServerListPlugin
struct ListServerInfo {
Jupiter::ReferenceString hostname;
std::string_view hostname;
unsigned short port;
Jupiter::ReferenceString namePrefix;
std::string_view namePrefix;
std::vector<std::string_view> attributes;
};

44
src/Plugins/RenX/RenX.SetJoin/RenX_SetJoin.cpp

@ -21,7 +21,7 @@
#include "RenX_Server.h"
#include "RenX_SetJoin.h"
using namespace Jupiter::literals;
using namespace std::literals;
void RenX_SetJoinPlugin::RenX_OnJoin(RenX::Server &server, const RenX::PlayerInfo &player) {
if (!player.uuid.empty() && server.isMatchInProgress()) {
@ -37,8 +37,8 @@ RenX_SetJoinPlugin pluginInstance;
// ViewJoin Game Command
void ViewJoinGameCommand::create() {
this->addTrigger("viewjoin"_jrs);
this->addTrigger("vjoin"_jrs);
this->addTrigger("viewjoin"sv);
this->addTrigger("vjoin"sv);
}
void ViewJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -48,14 +48,14 @@ void ViewJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
if (!setjoin.empty())
source->sendMessage(*player, string_printf("[%.*s] %.*s", player->name.size(), player->name.data(), setjoin.size(), setjoin.data()));
else
source->sendMessage(*player, "Error: No setjoin found."_jrs);
source->sendMessage(*player, "Error: No setjoin found."sv);
}
else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
source->sendMessage(*player, "Error: A setjoin message requires steam."sv);
}
std::string_view ViewJoinGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays your join message. Syntax: viewjoin");
static constexpr std::string_view defaultHelp = "Displays your join message. Syntax: viewjoin"sv;
return defaultHelp;
}
@ -64,8 +64,8 @@ GAME_COMMAND_INIT(ViewJoinGameCommand)
// ShowJoin Game Command
void ShowJoinGameCommand::create() {
this->addTrigger("showjoin"_jrs);
this->addTrigger("shjoin"_jrs);
this->addTrigger("showjoin"sv);
this->addTrigger("shjoin"sv);
}
void ShowJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -75,14 +75,14 @@ void ShowJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
if (!setjoin.empty())
source->sendMessage(string_printf("[%.*s] %.*s", player->name.size(), player->name.data(), setjoin.size(), setjoin.data()));
else
source->sendMessage(*player, "Error: No setjoin found."_jrs);
source->sendMessage(*player, "Error: No setjoin found."sv);
}
else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
source->sendMessage(*player, "Error: A setjoin message requires steam."sv);
}
std::string_view ShowJoinGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays your join message. Syntax: showjoin");
static constexpr std::string_view defaultHelp = "Displays your join message. Syntax: showjoin"sv;
return defaultHelp;
}
@ -92,10 +92,10 @@ GAME_COMMAND_INIT(ShowJoinGameCommand)
void DelJoinGameCommand::create()
{
this->addTrigger("deljoin"_jrs);
this->addTrigger("remjoin"_jrs);
this->addTrigger("djoin"_jrs);
this->addTrigger("rjoin"_jrs);
this->addTrigger("deljoin"sv);
this->addTrigger("remjoin"sv);
this->addTrigger("djoin"sv);
this->addTrigger("rjoin"sv);
}
void DelJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view ) {
@ -103,14 +103,14 @@ void DelJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (pluginInstance.setjoin_file.remove(player->uuid))
source->sendMessage(*player, string_printf("%.*s, your join message has been removed.", player->name.size(), player->name.data()));
else
source->sendMessage(*player, "Error: Setjoin not found."_jrs);
source->sendMessage(*player, "Error: Setjoin not found."sv);
}
else
source->sendMessage(*player, "Error: A setjoin message requires steam."_jrs);
source->sendMessage(*player, "Error: A setjoin message requires steam."sv);
}
std::string_view DelJoinGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Removes your automatic join message. Syntax: deljoin");
static constexpr std::string_view defaultHelp = "Removes your automatic join message. Syntax: deljoin"sv;
return defaultHelp;
}
@ -119,8 +119,8 @@ GAME_COMMAND_INIT(DelJoinGameCommand)
// SetJoin Game Command
void SetJoinGameCommand::create() {
this->addTrigger("setjoin"_jrs);
this->addTrigger("sjoin"_jrs);
this->addTrigger("setjoin"sv);
this->addTrigger("sjoin"sv);
}
void SetJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, std::string_view parameters) {
@ -133,11 +133,11 @@ void SetJoinGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
}
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."sv);
}
std::string_view SetJoinGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sets an automatic join message. Syntax: setjoin [message]");
static constexpr std::string_view defaultHelp = "Sets an automatic join message. Syntax: setjoin [message]"sv;
return defaultHelp;
}

48
src/Plugins/RenX/RenX.Warn/RenX_Warn.cpp

@ -22,11 +22,11 @@
#include "RenX_PlayerInfo.h"
#include "RenX_Warn.h"
using namespace Jupiter::literals;
using namespace std::literals;
bool RenX_WarnPlugin::initialize() {
m_maxWarns = this->config.get<int>("MaxWarns"_jrs, 3);
m_warnAction = this->config.get<int>("MaxAction"_jrs, -1);
m_maxWarns = this->config.get<int>("MaxWarns"sv, 3);
m_warnAction = this->config.get<int>("MaxAction"sv, -1);
return true;
}
@ -38,20 +38,20 @@ int RenX_WarnPlugin::OnRehash() {
// Plugin instantiation and entry point.
RenX_WarnPlugin pluginInstance;
STRING_LITERAL_AS_NAMED_REFERENCE(WARNS_KEY, "w");
static constexpr std::string_view WARNS_KEY = "w"sv;
// Warn IRC Command
void WarnIRCCommand::create() {
this->addTrigger("warn"_jrs);
this->addTrigger("w"_jrs);
this->addTrigger("warn"sv);
this->addTrigger("w"sv);
this->setAccessLevel(2);
}
void WarnIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters) {
auto parameters_split = jessilib::word_split_once_view(std::string_view{parameters}, WHITESPACE_SV);
if (parameters_split.second.empty()) {
source->sendNotice(nick, "Error: Too Few Parameters. Syntax: Warn <Player> <Reason>"_jrs);
source->sendNotice(nick, "Error: Too Few Parameters. Syntax: Warn <Player> <Reason>"sv);
return;
}
@ -62,7 +62,7 @@ void WarnIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::str
const auto& servers = RenX::getCore()->getServers(chan->getType());
if (servers.empty()) {
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
return;
}
@ -82,7 +82,7 @@ void WarnIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::str
source->sendNotice(nick, string_printf("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.data(), warns));
break;
default:
server->banPlayer(*player, "Jupiter Bot/RenX.Warn"_jrs, string_printf("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.m_warnAction));
server->banPlayer(*player, "Jupiter Bot/RenX.Warn"sv, string_printf("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.m_warnAction));
source->sendNotice(nick, string_printf("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", player->name.size(), player->name.data(), reason.size(), reason.data(), warns));
break;
}
@ -99,7 +99,7 @@ void WarnIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::str
}
std::string_view WarnIRCCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Warns a player. Syntax: Warn <Player> <Reason>");
static constexpr std::string_view defaultHelp = "Warns a player. Syntax: Warn <Player> <Reason>"sv;
return defaultHelp;
}
@ -108,9 +108,9 @@ IRC_COMMAND_INIT(WarnIRCCommand)
// Pardon IRC Command
void PardonIRCCommand::create() {
this->addTrigger("pardon"_jrs);
this->addTrigger("forgive"_jrs);
this->addTrigger("unwarn"_jrs);
this->addTrigger("pardon"sv);
this->addTrigger("forgive"sv);
this->addTrigger("unwarn"sv);
this->setAccessLevel(2);
}
@ -127,7 +127,7 @@ void PardonIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::s
const auto& servers = RenX::getCore()->getServers(chan->getType());
if (servers.empty()) {
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."_jrs);
source->sendMessage(channel, "Error: Channel not attached to any connected Renegade X servers."sv);
return;
}
@ -146,7 +146,7 @@ void PardonIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::s
}
std::string_view PardonIRCCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Resets a player's warnings. Syntax: Pardon <Player>");
static constexpr std::string_view defaultHelp = "Resets a player's warnings. Syntax: Pardon <Player>"sv;
return defaultHelp;
}
@ -155,8 +155,8 @@ IRC_COMMAND_INIT(PardonIRCCommand)
// Warn Game Command
void WarnGameCommand::create() {
this->addTrigger("warn"_jrs);
this->addTrigger("w"_jrs);
this->addTrigger("warn"sv);
this->addTrigger("w"sv);
this->setAccessLevel(1);
}
@ -177,7 +177,7 @@ void WarnGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
source->sendMessage(*player, string_printf("%.*s has been kicked from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.data(), warns));
break;
default:
source->banPlayer(*target, "Jupiter Bot/RenX.Warn"_jrs, string_printf("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.m_warnAction));
source->banPlayer(*target, "Jupiter Bot/RenX.Warn"sv, string_printf("Warning limit reached (%d warnings)", warns), std::chrono::seconds(pluginInstance.m_warnAction));
source->sendMessage(*player, string_printf("%.*s has been banned from the server for exceeding the warning limit (%d warnings).", target->name.size(), target->name.data(), warns));
break;
}
@ -190,11 +190,11 @@ void WarnGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, st
}
}
else
source->sendMessage(*player, "Error: Too few parameters. Syntax: Warn <Player> <Reason>"_jrs);
source->sendMessage(*player, "Error: Too few parameters. Syntax: Warn <Player> <Reason>"sv);
}
std::string_view WarnGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Warns a player. Syntax: Warn <Player> <Reason>");
static constexpr std::string_view defaultHelp = "Warns a player. Syntax: Warn <Player> <Reason>"sv;
return defaultHelp;
}
@ -203,9 +203,9 @@ GAME_COMMAND_INIT(WarnGameCommand)
// Pardon Game Command
void PardonGameCommand::create() {
this->addTrigger("pardon"_jrs);
this->addTrigger("forgive"_jrs);
this->addTrigger("unwarn"_jrs);
this->addTrigger("pardon"sv);
this->addTrigger("forgive"sv);
this->addTrigger("unwarn"sv);
this->setAccessLevel(1);
}
@ -224,7 +224,7 @@ void PardonGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
}
std::string_view PardonGameCommand::getHelp(std::string_view ) {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Resets a player's warnings. Syntax: Pardon <Player>");
static constexpr std::string_view defaultHelp = "Resets a player's warnings. Syntax: Pardon <Player>"sv;
return defaultHelp;
}

1
src/Plugins/RenX/RenX.Warn/RenX_Warn.h

@ -20,7 +20,6 @@
#define _RENX_WARN_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "IRC_Command.h"
#include "RenX_Plugin.h"
#include "RenX_GameCommand.h"

60
src/Plugins/SetJoin/SetJoin.cpp

@ -17,19 +17,22 @@
*/
#include <cstring>
#include "jessilib/unicode.hpp"
#include "Jupiter/Functions.h"
#include "SetJoin.h"
#include "IRC_Bot.h"
using namespace Jupiter::literals;
using namespace std::literals;
void SetJoinPlugin::OnJoin(Jupiter::IRC::Client *server, std::string_view chan, std::string_view nick)
{
void SetJoinPlugin::OnJoin(Jupiter::IRC::Client *server, std::string_view chan, std::string_view nick) {
std::string_view setjoin = this->config[server->getConfigSection()].get(nick);
if (setjoin.empty())
server->sendNotice(nick, "No setjoin has been set for you. To set one, use the !setjoin command"_jrs);
else
server->sendMessage(chan, string_printf(IRCBOLD IRCCOLOR "07[%.*s]" IRCCOLOR IRCBOLD ": %.*s", nick.size(), nick.data(), setjoin.size(), setjoin.data()));
if (setjoin.empty()) {
server->sendNotice(nick, "No setjoin has been set for you. To set one, use the !setjoin command"sv);
return;
}
std::string join_message = jessilib::join<std::string>(IRCBOLD IRCCOLOR "07["sv, nick, "]" IRCCOLOR IRCBOLD ": "sv, setjoin);
server->sendMessage(chan, join_message);
}
SetJoinPlugin pluginInstance;
@ -38,7 +41,7 @@ SetJoinPlugin pluginInstance;
void SetJoinIRCCommand::create()
{
this->addTrigger("setJoin"_jrs);
this->addTrigger("setJoin"sv);
}
void SetJoinIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters)
@ -47,14 +50,14 @@ void SetJoinIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::
{
pluginInstance.setjoin_file[source->getConfigSection()].set(nick, static_cast<std::string>(parameters));
pluginInstance.setjoin_file.write();
source->sendMessage(channel, "Your join message has been set."_jrs);
source->sendMessage(channel, "Your join message has been set."sv);
}
else source->sendMessage(channel, "Too few parameters! Syntax: setjoin <message>"_jrs);
else source->sendMessage(channel, "Too few parameters! Syntax: setjoin <message>"sv);
}
std::string_view SetJoinIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sets your join message. Syntax: setjoin <message>");
static constexpr std::string_view defaultHelp = "Sets your join message. Syntax: setjoin <message>"sv;
return defaultHelp;
}
@ -64,26 +67,29 @@ IRC_COMMAND_INIT(SetJoinIRCCommand)
void ViewJoinIRCCommand::create()
{
this->addTrigger("viewJoin"_jrs);
this->addTrigger("vJoin"_jrs);
this->addTrigger("viewJoin"sv);
this->addTrigger("vJoin"sv);
}
void ViewJoinIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters)
{
void ViewJoinIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters) {
std::string_view target = parameters.empty() ? nick : parameters;
std::string_view setjoin = pluginInstance.setjoin_file[source->getConfigSection()].get(target);
if (setjoin.empty())
source->sendMessage(channel, string_printf("No setjoin has been set for \"%.*s\".", target.size(),
target.data()));
else
source->sendMessage(channel, string_printf(IRCBOLD IRCCOLOR "07[%.*s]" IRCCOLOR IRCBOLD ": %.*s", target.size(),
target.data(), setjoin.size(), setjoin.data()));
if (setjoin.empty()) {
source->sendMessage(channel, jessilib::join<std::string>("No setjoin has been set for \""sv, target, "\"."sv));
}
else {
std::string join_message = IRCBOLD IRCCOLOR "07[";
join_message += target;
join_message += "]" IRCCOLOR IRCBOLD ": ";
join_message += setjoin;
source->sendMessage(channel, join_message);
}
}
std::string_view ViewJoinIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Views a user's join message. Syntax: viewjoin [user=you]");
static constexpr std::string_view defaultHelp = "Views a user's join message. Syntax: viewjoin [user=you]"sv;
return defaultHelp;
}
@ -93,20 +99,20 @@ IRC_COMMAND_INIT(ViewJoinIRCCommand)
void DelJoinIRCCommand::create()
{
this->addTrigger("delJoin"_jrs);
this->addTrigger("dJoin"_jrs);
this->addTrigger("delJoin"sv);
this->addTrigger("dJoin"sv);
}
void DelJoinIRCCommand::trigger(IRC_Bot *source, std::string_view channel, std::string_view nick, std::string_view parameters)
{
if (pluginInstance.setjoin_file[source->getConfigSection()].remove(nick))
source->sendNotice(nick, "Your setjoin has been deleted successfully."_jrs);
else source->sendNotice(nick, "No setjoin was found to delete."_jrs);
source->sendNotice(nick, "Your setjoin has been deleted successfully."sv);
else source->sendNotice(nick, "No setjoin was found to delete."sv);
}
std::string_view DelJoinIRCCommand::getHelp(std::string_view )
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Deletes your join message. Syntax: deljoin");
static constexpr std::string_view defaultHelp = "Deletes your join message. Syntax: deljoin"sv;
return defaultHelp;
}

Loading…
Cancel
Save