From 1887317e9754bf705c22a13d399db9f062ea5f57 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Sun, 8 Feb 2015 15:57:46 -0500 Subject: [PATCH] Updated to support most of RCONv3; updated Jupiter; Map now tracked; Tags added for: RCON User, Server Name, Map; Internal tags are now generated at runtime, and guaranteed to be unique for up to 65k tags; Added events to RenX::Plugin: OnExecute (player), OnPlayer, OnHostChat, OnHostPage, OnOtherChat, OnDisarm, OnCapture, OnNeutralize, OnSteal, OnUnsubscribe, OnVoteCall, OnVoteOver, OnVoteCancel, OnVote, OnMapChange, OnMapLoad, OnMap, OnDemoRecord, OnDemo; various optimizations --- Jupiter | 2 +- Release/Bot.lib | Bin 19858 -> 19858 bytes Release/Plugins/RenX.Core.lib | Bin 79548 -> 93934 bytes RenX.Commands/RenX_Commands.cpp | 24 +- RenX.Core/RenX.h | 14 +- RenX.Core/RenX_Functions.cpp | 87 +- RenX.Core/RenX_Functions.h | 1 + RenX.Core/RenX_PlayerInfo.h | 2 +- RenX.Core/RenX_Plugin.cpp | 118 ++- RenX.Core/RenX_Plugin.h | 39 +- RenX.Core/RenX_Server.cpp | 1473 +++++++++++++++++++++++-------- RenX.Core/RenX_Server.h | 41 +- RenX.Core/RenX_Tags.cpp | 181 ++-- RenX.Core/RenX_Tags.h | 146 +-- RenX.Logging/RenX_Logging.cpp | 541 ++++++++++-- RenX.Logging/RenX_Logging.h | 77 +- RenX.Medals/RenX_Medals.cpp | 2 +- RenX.Medals/RenX_Medals.h | 2 +- 18 files changed, 2131 insertions(+), 619 deletions(-) diff --git a/Jupiter b/Jupiter index 62099f3..46ce354 160000 --- a/Jupiter +++ b/Jupiter @@ -1 +1 @@ -Subproject commit 62099f36ae435456763be46ded5fc6f858ad709e +Subproject commit 46ce3548d245459aba3f0b14c7fd7fd8528a0c59 diff --git a/Release/Bot.lib b/Release/Bot.lib index 12f7848a7d593062c933779863b0882928139fb4..0cecd97a7f2c2f292339cfb609b6b0135321d675 100644 GIT binary patch delta 1541 z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6u239y{YOm%Y0#M2QB-!oqTe>nR6!ZWw>_wBFC`E$u^Q2;+6aeZSMe;G)3jhEB diff --git a/RenX.Commands/RenX_Commands.cpp b/RenX.Commands/RenX_Commands.cpp index fd8b97e..f44d387 100644 --- a/RenX.Commands/RenX_Commands.cpp +++ b/RenX.Commands/RenX_Commands.cpp @@ -1,5 +1,5 @@ /** - * Copyright (C) 2014 Justin James. + * Copyright (C) 2014-2015 Justin James. * * This license must be preserved. * Any applications, libraries, or code which make any use of any @@ -170,15 +170,27 @@ void MsgIRCCommand::create() void MsgIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString ¶meters) { if (parameters.isEmpty() == false) - { - Jupiter::StringL msg = "say "; + { + int type = source->getChannel(channel)->getType(); + Jupiter::StringL msg; char prefix = source->getChannel(channel)->getUserPrefix(nick); if (prefix != '\0') msg += prefix; msg += nick; msg += "@IRC: "; msg += parameters; - if (RenX::getCore()->send(source->getChannel(channel)->getType(), msg) == 0) + + prefix = '\0'; // Reusing prefix to check if a match is ever found. + for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) + { + RenX::Server *server = RenX::getCore()->getServer(i); + if (server->isLogChanType(type)) + { + server->sendMessage(msg); + prefix = 1; + } + } + if (prefix == '\0') source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Channel not attached to any connected Renegade X servers.")); } else source->sendNotice(nick, STRING_LITERAL_AS_REFERENCE("Error: Too Few Parameters. Syntax: Msg ")); @@ -1747,7 +1759,7 @@ void ModsGameCommand::create() void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Jupiter::ReadableString &) { RenX::PlayerInfo *player; - Jupiter::StringL msg = "say "; + Jupiter::StringL msg; for (Jupiter::DLList::Node *node = source->players.getNode(0); node != nullptr; node = node->next) { player = node->data; @@ -1767,7 +1779,7 @@ void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Ju msg.aformat("; please use \"%.*s%.*s\" if you require assistance.", source->getCommandPrefix().size(), source->getCommandPrefix().ptr(), cmd->getTrigger().size(), cmd->getTrigger().ptr()); else msg += '.'; } - source->send(msg); + source->sendMessage(msg); } const Jupiter::ReadableString &ModsGameCommand::getHelp(const Jupiter::ReadableString &) diff --git a/RenX.Core/RenX.h b/RenX.Core/RenX.h index f175343..43d223f 100644 --- a/RenX.Core/RenX.h +++ b/RenX.Core/RenX.h @@ -1,5 +1,5 @@ /** - * Copyright (C) 2014 Justin James. + * Copyright (C) 2014-2015 Justin James. * * This license must be preserved. * Any applications, libraries, or code which make any use of any @@ -39,7 +39,7 @@ namespace RenX { - enum WinType + enum class WinType { Score, Base, @@ -49,19 +49,21 @@ namespace RenX Unknown }; - enum TeamType + enum class TeamType { GDI, Nod, - Other + Other, + None }; - enum ObjectType + enum class ObjectType { Player, Vehicle, Building, - Defence + Defence, + None }; } diff --git a/RenX.Core/RenX_Functions.cpp b/RenX.Core/RenX_Functions.cpp index 37548b6..a3af4bd 100644 --- a/RenX.Core/RenX_Functions.cpp +++ b/RenX.Core/RenX_Functions.cpp @@ -61,6 +61,17 @@ Jupiter::ReferenceString tieWinTypePlainTranslation = "Tie"; Jupiter::ReferenceString shutdownWinTypePlainTranslation = "Shutdown"; Jupiter::ReferenceString 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"); + /** Object / damage type translations */ /** Nod Vehicles */ @@ -203,8 +214,6 @@ Jupiter::ReferenceString translated_DmgType_RocketEmpl_Missile = STRING_LITERAL_ Jupiter::ReferenceString translated_DmgType_Nuke = STRING_LITERAL_AS_REFERENCE("Nuclear Missile Strike"); Jupiter::ReferenceString translated_DmgType_IonCannon = STRING_LITERAL_AS_REFERENCE("Ion Cannon Strike"); -// Vehicles copied from above. - /** Nod Vehicles */ Jupiter::ReferenceString translated_DmgType_Harvester_Nod = STRING_LITERAL_AS_REFERENCE("Nod Harvester"); Jupiter::ReferenceString translated_DmgType_Buggy = STRING_LITERAL_AS_REFERENCE("Buggy"); @@ -273,12 +282,12 @@ RenX::TeamType RenX::getTeam(char team) { case 'g': case 'G': - return GDI; + return RenX::TeamType::GDI; case 'n': case 'N': - return Nod; + return RenX::TeamType::Nod; default: - return Other; + return RenX::TeamType::Other; } } @@ -286,9 +295,9 @@ const Jupiter::ReadableString &RenX::getTeamColor(TeamType team) { switch (team) { - case GDI: + case RenX::TeamType::GDI: return GDIColor; - case Nod: + case RenX::TeamType::Nod: return NodColor; default: return OtherColor; @@ -299,9 +308,9 @@ const Jupiter::ReadableString &RenX::getTeamName(TeamType team) { switch (team) { - case GDI: + case RenX::TeamType::GDI: return GDIShortName; - case Nod: + case RenX::TeamType::Nod: return NodShortName; default: return OtherShortName; @@ -312,9 +321,9 @@ const Jupiter::ReadableString &RenX::getFullTeamName(TeamType team) { switch (team) { - case GDI: + case RenX::TeamType::GDI: return GDILongName; - case Nod: + case RenX::TeamType::Nod: return NodLongName; default: return OtherLongName; @@ -325,12 +334,12 @@ RenX::TeamType RenX::getEnemy(TeamType team) { switch (team) { - case GDI: - return Nod; - case Nod: - return GDI; + case RenX::TeamType::GDI: + return RenX::TeamType::Nod; + case RenX::TeamType::Nod: + return RenX::TeamType::GDI; default: - return Other; + return RenX::TeamType::Other; } } @@ -608,6 +617,18 @@ const Jupiter::ReadableString &RenX::translateName(const Jupiter::ReadableString if (object.equals(STRING_LITERAL_AS_REFERENCE("VehicleExplosion"))) return translated_UTDmgType_VehicleExplosion; if (object.equals(STRING_LITERAL_AS_REFERENCE("Drowned"))) return translated_UTDmgType_Drowned; } + else if (object.find(STRING_LITERAL_AS_REFERENCE("VoteMenuChoice_")) == 0) + { + object.shiftRight(15); + if (object.equals(STRING_LITERAL_AS_REFERENCE("AddBots"))) return translated_VoteMenuChoice_AddBots; + if (object.equals(STRING_LITERAL_AS_REFERENCE("ChangeMap"))) return translated_VoteMenuChoice_ChangeMap; + if (object.equals(STRING_LITERAL_AS_REFERENCE("Donate"))) return translated_VoteMenuChoice_Donate; + if (object.equals(STRING_LITERAL_AS_REFERENCE("Kick"))) return translated_VoteMenuChoice_Kick; + if (object.equals(STRING_LITERAL_AS_REFERENCE("RemoveBots"))) return translated_VoteMenuChoice_RemoveBots; + if (object.equals(STRING_LITERAL_AS_REFERENCE("RestartMatch"))) return translated_VoteMenuChoice_RestartMatch; + if (object.equals(STRING_LITERAL_AS_REFERENCE("StartMatch"))) return translated_VoteMenuChoice_StartMatch; + if (object.equals(STRING_LITERAL_AS_REFERENCE("Survey"))) return translated_VoteMenuChoice_Survey; + } else if (object.equals(STRING_LITERAL_AS_REFERENCE("IonCannonBeacon"))) return translated_IonCannonBeacon; else if (object.equals(STRING_LITERAL_AS_REFERENCE("NukeBeacon"))) return translated_NukeBeacon; else if (object.equals(STRING_LITERAL_AS_REFERENCE("KillZDamageType"))) return translated_KillZDamageType; @@ -618,17 +639,17 @@ const Jupiter::ReadableString &RenX::translateWinType(RenX::WinType winType) { switch (winType) { - case Score: + case RenX::WinType::Score: return scoreWinTypeTranslation; - case Base: + case RenX::WinType::Base: return baseWinTypeTranslation; - case Beacon: + case RenX::WinType::Beacon: return beaconWinTypeTranslation; - case Tie: + case RenX::WinType::Tie: return tieWinTypeTranslation; - case Shutdown: + case RenX::WinType::Shutdown: return shutdownWinTypeTranslation; - case Unknown: + case RenX::WinType::Unknown: default: return unknownWinTypeTranslation; } @@ -638,17 +659,17 @@ const Jupiter::ReadableString &RenX::translateWinTypePlain(RenX::WinType winType { switch (winType) { - case Score: + case RenX::WinType::Score: return scoreWinTypePlainTranslation; - case Base: + case RenX::WinType::Base: return baseWinTypePlainTranslation; - case Beacon: + case RenX::WinType::Beacon: return beaconWinTypePlainTranslation; - case Tie: + case RenX::WinType::Tie: return tieWinTypePlainTranslation; - case Shutdown: + case RenX::WinType::Shutdown: return shutdownWinTypePlainTranslation; - case Unknown: + case RenX::WinType::Unknown: default: return unknownWinTypePlainTranslation; } @@ -710,6 +731,16 @@ void RenX::sanitizeString(char *str) } } +void RenX::sanitizeString(Jupiter::StringType &str) +{ + if (str.isEmpty() == false) + { + str.replace('|', '/'); + if (str.get(str.size() - 1) == '\\') + str.set(str.size() - 1, '/'); + } +} + time_t RenX::getGameTime(const RenX::PlayerInfo *player) { time_t currentTime = time(0); diff --git a/RenX.Core/RenX_Functions.h b/RenX.Core/RenX_Functions.h index 8b2306e..ec07af7 100644 --- a/RenX.Core/RenX_Functions.h +++ b/RenX.Core/RenX_Functions.h @@ -133,6 +133,7 @@ namespace RenX * @brief str String to sanitize. */ RENX_API void sanitizeString(char *str); + RENX_API void sanitizeString(Jupiter::StringType &str); /** * @brief Calculates for how many seconds a player has been in-game. diff --git a/RenX.Core/RenX_PlayerInfo.h b/RenX.Core/RenX_PlayerInfo.h index ae0b0bd..327e9dd 100644 --- a/RenX.Core/RenX_PlayerInfo.h +++ b/RenX.Core/RenX_PlayerInfo.h @@ -50,7 +50,7 @@ namespace RenX Jupiter::StringS vehicle; uint64_t steamid = 0; uint32_t ip32 = 0; - TeamType team = Other; + TeamType team = TeamType::Other; int id = 0; bool isBot = false; time_t joinTime = 0; diff --git a/RenX.Core/RenX_Plugin.cpp b/RenX.Core/RenX_Plugin.cpp index af42782..6b2b879 100644 --- a/RenX.Core/RenX_Plugin.cpp +++ b/RenX.Core/RenX_Plugin.cpp @@ -75,7 +75,17 @@ void RenX::Plugin::RenX_OnNameChange(Server *, const PlayerInfo *, const Jupiter return; } -void RenX::Plugin::RenX_OnTeamChange(Server *, const PlayerInfo *) +void RenX::Plugin::RenX_OnTeamChange(Server *, const PlayerInfo *, const TeamType &) +{ + return; +} + +void RenX::Plugin::RenX_OnExecute(Server *, const PlayerInfo *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnPlayer(Server *, const Jupiter::ReadableString &) { return; } @@ -90,11 +100,31 @@ void RenX::Plugin::RenX_OnTeamChat(Server *, const RenX::PlayerInfo *, const Jup return; } +void RenX::Plugin::RenX_OnHostChat(Server *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnHostPage(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnOtherChat(Server *, const Jupiter::ReadableString &) +{ + return; +} + void RenX::Plugin::RenX_OnDeploy(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) { return; } +void RenX::Plugin::RenX_OnDisarm(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) +{ + return; +} + void RenX::Plugin::RenX_OnSuicide(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &) { return; @@ -105,7 +135,7 @@ void RenX::Plugin::RenX_OnKill(Server *, const RenX::PlayerInfo *, const RenX::P return; } -void RenX::Plugin::RenX_OnKill(Server *, const Jupiter::ReadableString &, TeamType, const RenX::PlayerInfo *, const Jupiter::ReadableString &) +void RenX::Plugin::RenX_OnKill(Server *, const Jupiter::ReadableString &, const TeamType &, const RenX::PlayerInfo *, const Jupiter::ReadableString &) { return; } @@ -115,7 +145,7 @@ void RenX::Plugin::RenX_OnDie(Server *, const RenX::PlayerInfo *, const Jupiter: return; } -void RenX::Plugin::RenX_OnDie(Server *, const Jupiter::ReadableString &, TeamType, const Jupiter::ReadableString &) +void RenX::Plugin::RenX_OnDie(Server *, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &) { return; } @@ -125,12 +155,32 @@ void RenX::Plugin::RenX_OnDestroy(Server *, const RenX::PlayerInfo *, const Jupi return; } -void RenX::Plugin::RenX_OnDestroy(Server *, const Jupiter::ReadableString &, TeamType, const Jupiter::ReadableString &, TeamType, const Jupiter::ReadableString &, ObjectType) +void RenX::Plugin::RenX_OnDestroy(Server *, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, const TeamType &, const Jupiter::ReadableString &, ObjectType) +{ + return; +} + +void RenX::Plugin::RenX_OnCapture(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const TeamType &) { return; } -void RenX::Plugin::RenX_OnGameOver(Server *, RenX::WinType, TeamType, int, int) +void RenX::Plugin::RenX_OnNeutralize(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const TeamType &) +{ + return; +} + +void RenX::Plugin::RenX_OnSteal(Server *, const PlayerInfo *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnSteal(Server *, const PlayerInfo *, const Jupiter::ReadableString &, const PlayerInfo *) +{ + return; +} + +void RenX::Plugin::RenX_OnGameOver(Server *, RenX::WinType, const TeamType &, int, int) { return; } @@ -150,6 +200,11 @@ void RenX::Plugin::RenX_OnSubscribe(Server *, const Jupiter::ReadableString &) return; } +void RenX::Plugin::RenX_OnUnsubscribe(Server *, const Jupiter::ReadableString &) +{ + return; +} + void RenX::Plugin::RenX_OnRCON(Server *, const Jupiter::ReadableString &) { return; @@ -175,6 +230,57 @@ void RenX::Plugin::RenX_OnAdmin(Server *, const Jupiter::ReadableString &) return; } +void RenX::Plugin::RenX_OnVoteCall(Server *, const TeamType &, const Jupiter::ReadableString &, const PlayerInfo *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnVoteOver(Server *server, const TeamType &, const Jupiter::ReadableString &, bool, int, int) +{ + return; +} + +void RenX::Plugin::RenX_OnVoteCancel(Server *, const TeamType &, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnVote(Server *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnMapChange(Server *, const Jupiter::ReadableString &, bool) +{ + return; +} + +void RenX::Plugin::RenX_OnMapLoad(Server *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnMap(Server *, const Jupiter::ReadableString &) +{ + return; +} + +void RenX::Plugin::RenX_OnDemoRecord(Server *server, const PlayerInfo *) +{ + return; +} + +void RenX::Plugin::RenX_OnDemoRecord(Server *server, const Jupiter::ReadableString &) +{ + return; +} + + +void RenX::Plugin::RenX_OnDemo(Server *server, const Jupiter::ReadableString &) +{ + return; +} + void RenX::Plugin::RenX_OnLog(Server *, const Jupiter::ReadableString &) { return; @@ -200,7 +306,7 @@ void RenX::Plugin::RenX_OnSpawnVehicle(Server *, const PlayerInfo *, const Jupit return; } -void RenX::Plugin::RenX_OnSpawnVehicleNoOwner(Server *, const TeamType, const Jupiter::ReadableString &) +void RenX::Plugin::RenX_OnSpawnVehicleNoOwner(Server *, const TeamType &, const Jupiter::ReadableString &) { return; } diff --git a/RenX.Core/RenX_Plugin.h b/RenX.Core/RenX_Plugin.h index 7c3fdc8..b5764e4 100644 --- a/RenX.Core/RenX_Plugin.h +++ b/RenX.Core/RenX_Plugin.h @@ -51,27 +51,38 @@ namespace RenX virtual void RenX_OnJoin(Server *server, const PlayerInfo *player); virtual void RenX_OnPart(Server *server, const PlayerInfo *player); virtual void RenX_OnNameChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newPlayerName); - virtual void RenX_OnTeamChange(Server *server, const PlayerInfo *player); + virtual void RenX_OnTeamChange(Server *server, const PlayerInfo *player, const TeamType &oldTeam); + virtual void RenX_OnExecute(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &command); + virtual void RenX_OnPlayer(Server *server, const Jupiter::ReadableString &raw); /** Chat type logs */ virtual void RenX_OnChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); virtual void RenX_OnTeamChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); + virtual void RenX_OnHostChat(Server *server, const Jupiter::ReadableString &message); + virtual void RenX_OnHostPage(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message); + virtual void RenX_OnOtherChat(Server *server, const Jupiter::ReadableString &raw); /** Game type logs */ virtual void RenX_OnDeploy(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object); + virtual void RenX_OnDisarm(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &object); virtual void RenX_OnSuicide(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &damageType); virtual void RenX_OnKill(Server *server, const PlayerInfo *player, const PlayerInfo *victim, const Jupiter::ReadableString &damageType); - virtual void RenX_OnKill(Server *server, const Jupiter::ReadableString &killer, TeamType killerTeam, const PlayerInfo *victim, const Jupiter::ReadableString &damageType); + virtual void RenX_OnKill(Server *server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const PlayerInfo *victim, const Jupiter::ReadableString &damageType); virtual void RenX_OnDie(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &damageType); - virtual void RenX_OnDie(Server *server, const Jupiter::ReadableString &object, TeamType objectTeam, const Jupiter::ReadableString &damageType); + virtual void RenX_OnDie(Server *server, const Jupiter::ReadableString &object, const TeamType &objectTeam, const Jupiter::ReadableString &damageType); virtual void RenX_OnDestroy(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &objectName, const Jupiter::ReadableString &damageType, ObjectType type); - virtual void RenX_OnDestroy(Server *server, const Jupiter::ReadableString &killer, TeamType killerTeam, const Jupiter::ReadableString &objectName, TeamType objectTeam, const Jupiter::ReadableString &damageType, ObjectType type); - virtual void RenX_OnGameOver(Server *server, WinType winType, TeamType team, int gScore, int nScore); + virtual void RenX_OnDestroy(Server *server, const Jupiter::ReadableString &killer, const TeamType &killerTeam, const Jupiter::ReadableString &objectName, const TeamType &objectTeam, const Jupiter::ReadableString &damageType, ObjectType type); + virtual void RenX_OnCapture(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &building, const TeamType &oldTeam); + virtual void RenX_OnNeutralize(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &building, const TeamType &oldTeam); + virtual void RenX_OnSteal(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &vehicle); + virtual void RenX_OnSteal(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &vehicle, const PlayerInfo *victim); + virtual void RenX_OnGameOver(Server *server, WinType winType, const TeamType &team, int gScore, int nScore); virtual void RenX_OnGame(Server *server, const Jupiter::ReadableString &raw); /** RCON type logs */ virtual void RenX_OnExecute(Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command); virtual void RenX_OnSubscribe(Server *server, const Jupiter::ReadableString &user); + virtual void RenX_OnUnsubscribe(Server *server, const Jupiter::ReadableString &user); virtual void RenX_OnRCON(Server *server, const Jupiter::ReadableString &raw); /** Admin Type Logs */ @@ -80,6 +91,22 @@ namespace RenX virtual void RenX_OnAdminLogout(Server *server, const PlayerInfo *player); virtual void RenX_OnAdmin(Server *server, const Jupiter::ReadableString &raw); + /** Vote Type Logs */ + virtual void RenX_OnVoteCall(Server *server, const TeamType &team, const Jupiter::ReadableString &type, const PlayerInfo *player, const Jupiter::ReadableString ¶meters); + virtual void RenX_OnVoteOver(Server *server, const TeamType &team, const Jupiter::ReadableString &type, bool success, int yesVotes, int noVotes); + virtual void RenX_OnVoteCancel(Server *server, const TeamType &team, const Jupiter::ReadableString &type); + virtual void RenX_OnVote(Server *server, const Jupiter::ReadableString &raw); + + /** Map Type Logs */ + virtual void RenX_OnMapChange(Server *server, const Jupiter::ReadableString &map, bool seamless); + virtual void RenX_OnMapLoad(Server *server, const Jupiter::ReadableString &map); + virtual void RenX_OnMap(Server *server, const Jupiter::ReadableString &raw); + + /** Demo Type Logs */ + virtual void RenX_OnDemoRecord(Server *server, const PlayerInfo *player); + virtual void RenX_OnDemoRecord(Server *server, const Jupiter::ReadableString &user); // Note: user is currently always empty. + virtual void RenX_OnDemo(Server *server, const Jupiter::ReadableString &raw); + /** Other Logs */ virtual void RenX_OnLog(Server *server, const Jupiter::ReadableString &raw); @@ -88,7 +115,7 @@ namespace RenX virtual void RenX_OnGrantCharacter(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character); virtual void RenX_OnGrantWeapon(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &weapon); virtual void RenX_OnSpawnVehicle(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle); - virtual void RenX_OnSpawnVehicleNoOwner(Server *server, const TeamType team, const Jupiter::ReadableString &vehicle); + virtual void RenX_OnSpawnVehicleNoOwner(Server *server, const TeamType &team, const Jupiter::ReadableString &vehicle); virtual void RenX_OnMinePlace(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &mine); virtual void RenX_XOnOther(Server *server, const Jupiter::ReadableString &raw); diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp index 4209922..574dc04 100644 --- a/RenX.Core/RenX_Server.cpp +++ b/RenX.Core/RenX_Server.cpp @@ -45,14 +45,17 @@ int RenX::Server::think() Jupiter::ReferenceString buffer = RenX::Server::sock.getBuffer(); unsigned int totalLines = buffer.tokenCount('\n'); - RenX::Server::lastLine.concat(buffer.getToken(0, '\n')); if (totalLines != 0) { - RenX::Server::processLine(RenX::Server::lastLine); - RenX::Server::lastLine = buffer.getToken(totalLines - 1, '\n'); + RenX::Server::lastLine.concat(buffer.getToken(0, '\n')); + if (totalLines != 1) // if there's only one token, there is no newline. + { + RenX::Server::processLine(RenX::Server::lastLine); + RenX::Server::lastLine = buffer.getToken(totalLines - 1, '\n'); - for (unsigned int currentLine = 1; currentLine != totalLines - 1; currentLine++) - RenX::Server::processLine(buffer.getToken(currentLine, '\n')); + for (unsigned int currentLine = 1; currentLine != totalLines - 1; currentLine++) + RenX::Server::processLine(buffer.getToken(currentLine, '\n')); + } } } else if (Jupiter::Socket::getLastError() != 10035) // This is a serious error @@ -163,26 +166,30 @@ int RenX::Server::send(const Jupiter::ReadableString &command) int RenX::Server::sendMessage(const Jupiter::ReadableString &message) { - int r = 0; if (RenX::Server::neverSay) { + int r = 0; if (RenX::Server::profile->privateMessages && RenX::Server::players.size() != 0) for (Jupiter::DLList::Node *node = RenX::Server::players.getNode(0); node != nullptr; node = node->next) if (node->data->isBot == false) - r += RenX::Server::sock.send(Jupiter::StringS::Format("cevaprivatesay pid%d %.*s\n", node->data->id, message.size(), message.ptr())); + { + if (RenX::Server::rconVersion <= 2) + r += RenX::Server::sock.send(Jupiter::StringS::Format("cevaprivatesay pid%d %.*s\n", node->data->id, message.size(), message.ptr())); + else + r += RenX::Server::sock.send(Jupiter::StringS::Format("chostprivatesay pid%d %.*s\n", node->data->id, message.size(), message.ptr())); + } return r; } else { - char *t = new char[message.size() + 6]; - strcpy(t, "csay "); - for (size_t i = 0; i != message.size(); i++) t[i + 5] = message.get(i); - t[message.size() + 5] = '\n'; + Jupiter::StringS cmd = STRING_LITERAL_AS_REFERENCE("chostsay "); + if (RenX::Server::rconVersion <= 2) + cmd = STRING_LITERAL_AS_REFERENCE("csay "); + cmd += message; + cmd += '\n'; if (RenX::Server::profile->mustSanitize) - RenX::sanitizeString(t); - r = RenX::Server::sock.send(t, message.size() + 6); - delete[] t; - return r; + RenX::sanitizeString(cmd); + return RenX::Server::sock.send(cmd); } } @@ -191,7 +198,9 @@ int RenX::Server::sendMessage(const RenX::PlayerInfo *player, const Jupiter::Rea if (RenX::Server::profile->privateMessages == false) return RenX::Server::sendMessage(message); - return RenX::Server::sock.send(Jupiter::StringS::Format("cevaprivatesay pid%d %.*s\n", player->id, message.size(), message.ptr())); + if (RenX::Server::rconVersion <= 2) + return RenX::Server::sock.send(Jupiter::StringS::Format("cevaprivatesay pid%d %.*s\n", player->id, message.size(), message.ptr())); + return RenX::Server::sock.send(Jupiter::StringS::Format("chostprivatesay pid%d %.*s\n", player->id, message.size(), message.ptr())); } int RenX::Server::sendData(const Jupiter::ReadableString &data) @@ -358,6 +367,15 @@ bool RenX::Server::removePlayer(RenX::PlayerInfo *player) return RenX::Server::removePlayer(player->id); } +bool RenX::Server::updateClientList() +{ + if (RenX::Server::xRconVersion != 0) + return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("_x\x01\n")) > 0; + if (RenX::Server::rconVersion <= 2) + return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("clogclientlist\n")) > 0; + return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("cclientlist\n")) > 0; +} + bool RenX::Server::giveCredits(int id, double credits) { return RenX::Server::xRconVersion != 0 && RenX::Server::sock.send(Jupiter::StringS::Format("_x\x04%d%c%.4f\n", id, RenX::DelimC, credits)) > 0; @@ -445,6 +463,21 @@ const Jupiter::ReadableString &RenX::Server::getPassword() const return RenX::Server::pass; } +const Jupiter::ReadableString &RenX::Server::getUser() const +{ + return RenX::Server::rconUser; +} + +const Jupiter::ReadableString &RenX::Server::getName() const +{ + return RenX::Server::serverName; +} + +const Jupiter::ReadableString &RenX::Server::getMap() const +{ + return RenX::Server::map; +} + RenX::GameCommand *RenX::Server::getCommand(unsigned int index) const { return RenX::Server::commands.get(index); @@ -609,24 +642,20 @@ void RenX::Server::sendLogChan(const Jupiter::ReadableString &msg) const bool isBot; \ parsePlayerData(DATA, name, team, id, isBot); -#define PARSE_PLAYER_DATA() PARSE_PLAYER_DATA_P(playerData) - void RenX::Server::processLine(const Jupiter::ReadableString &line) { Jupiter::ReferenceString buff = line; Jupiter::ArrayList &xPlugins = *RenX::getCore()->getPlugins(); Jupiter::ReferenceString header = buff.getToken(0, RenX::DelimC); - Jupiter::ReferenceString playerData = buff.getToken(1, RenX::DelimC); - Jupiter::ReferenceString action = buff.getToken(2, RenX::DelimC); /** Local functions */ - auto onPreGameOver = [&](RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) + auto onPreGameOver = [this](RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) { RenX::PlayerInfo *player; - if (server->players.size() != 0) + if (this->players.size() != 0) { - for (Jupiter::DLList::Node *n = server->players.getNode(0); n != nullptr; n = n->next) + for (Jupiter::DLList::Node *n = this->players.getNode(0); n != nullptr; n = n->next) { player = n->data; if (player != nullptr) @@ -638,7 +667,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) } } }; - auto onPostGameOver = [&](RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) + auto onPostGameOver = [this](RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) { this->firstGame = false; this->firstAction = false; @@ -646,9 +675,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) this->firstDeath = false; RenX::PlayerInfo *player; - if (server->players.size() != 0) + if (this->players.size() != 0) { - for (Jupiter::DLList::Node *n = server->players.getNode(0); n != nullptr; n = n->next) + for (Jupiter::DLList::Node *n = this->players.getNode(0); n != nullptr; n = n->next) { player = n->data; if (player != nullptr) @@ -664,9 +693,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) } } }; - auto onChat = [&](RenX::Server *server, RenX::PlayerInfo *player, const Jupiter::ReadableString &message, bool isPublic) + auto onChat = [this](RenX::PlayerInfo *player, const Jupiter::ReadableString &message) { - const Jupiter::ReadableString &prefix = server->getCommandPrefix(); + const Jupiter::ReadableString &prefix = this->getCommandPrefix(); if (message.find(prefix) == 0 && message.size() != prefix.size()) { Jupiter::ReferenceString command; @@ -682,10 +711,10 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) command.shiftRight(prefix.size()); parameters = Jupiter::ReferenceString::gotoWord(message, 1, WHITESPACE); } - server->triggerCommand(command, player, parameters); + this->triggerCommand(command, player, parameters); } }; - auto onAction = [&]() + auto onAction = [this]() { if (this->firstAction == false) { @@ -693,12 +722,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) this->silenceJoins = false; } }; - auto parsePlayerData = [&](const Jupiter::ReadableString &data, Jupiter::ReferenceString &name, TeamType &team, int &id, bool &isBot) + auto parsePlayerData = [this](const Jupiter::ReadableString &data, Jupiter::ReferenceString &name, TeamType &team, int &id, bool &isBot) { Jupiter::ReferenceString idToken = Jupiter::ReferenceString::getToken(data, 1, ','); name = Jupiter::ReferenceString::gotoToken(data, 2, ','); if (data[0] == ',') - team = Other; + team = TeamType::Other; else team = RenX::getTeam(data[0]); if (idToken.get(0) == 'b') @@ -710,10 +739,10 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) isBot = false; id = idToken.asInt(10); }; - auto getPlayerOrAdd = [&](RenX::Server *server, const Jupiter::ReadableString &name, int id, RenX::TeamType team, bool isBot, uint64_t steamid, const Jupiter::ReadableString &ip) + auto getPlayerOrAdd = [&](const Jupiter::ReadableString &name, int id, RenX::TeamType team, bool isBot, uint64_t steamid, const Jupiter::ReadableString &ip) { bool checkBans = false; - RenX::PlayerInfo *r = server->getPlayer(id); + RenX::PlayerInfo *r = this->getPlayer(id); auto checkMissing = [&]() { if (r->ip32 == 0 && ip.isEmpty() == false) @@ -741,12 +770,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) r->formatNamePrefix = IRCCOLOR "05[B]"; r->joinTime = time(nullptr); if (id != 0) - server->players.add(r); + this->players.add(r); if (this->uuidMode == 1) r->uuid = r->name; for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnPlayerCreate(server, r); + xPlugins.get(i)->RenX_OnPlayerCreate(this, r); } else { @@ -766,345 +795,1065 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) { if (entry->length != 0 && entry->timestamp + entry->length < time(0)) banDatabase->deactivate(i); - else if (server->localSteamBan && entry->steamid != 0 && entry->steamid == r->steamid) - server->kickPlayer(r); - else if (server->localIPBan && entry->ip != 0 && entry->ip == r->ip32) - server->kickPlayer(r); - else if (server->localNameBan && entry->name.isEmpty() == false && entry->name.equalsi(r->name)) - server->kickPlayer(r); + else if (this->localSteamBan && entry->steamid != 0 && entry->steamid == r->steamid) + this->kickPlayer(r); + else if (this->localIPBan && entry->ip != 0 && entry->ip == r->ip32) + this->kickPlayer(r); + else if (this->localNameBan && entry->name.isEmpty() == false && entry->name.equalsi(r->name)) + this->kickPlayer(r); } } } return r; }; + auto parseGetPlayerOrAdd = [&parsePlayerData, &getPlayerOrAdd](const Jupiter::ReadableString &token) + { + PARSE_PLAYER_DATA_P(token); + return getPlayerOrAdd(name, id, team, isBot, 0U, Jupiter::ReferenceString::empty); + }; if (buff.size() != 0) { switch (header[0]) { + case 'r': + if (this->lastCommand.equalsi("clientlist")) + { + // ID | IP | Steam ID | Admin Status | Team | Name + header.shiftRight(1); + if (header.isEmpty() == false) + { + bool isBot = false; + int id; + uint64_t steamid = 0; + RenX::TeamType team = TeamType::Other; + Jupiter::ReferenceString steamToken = buff.getToken(2, RenX::DelimC); + Jupiter::ReferenceString adminToken = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString teamToken = buff.getToken(4, RenX::DelimC); + if (header.get(0) == 'b') + { + isBot = true; + header.shiftRight(1); + id = header.asInt(); + header.shiftLeft(1); + } + else + id = header.asInt(); + + if (steamToken.equals("-----NO-STEAM-----") == false) + steamid = steamToken.asUnsignedLongLong(); + + if (teamToken.isEmpty() == false) + team = RenX::getTeam(teamToken.get(0)); + + if (adminToken.equalsi("None")) + getPlayerOrAdd(buff.getToken(5, RenX::DelimC), id, team, isBot, steamid, buff.getToken(1, RenX::DelimC)); + else + getPlayerOrAdd(buff.getToken(5, RenX::DelimC), id, team, isBot, steamid, buff.getToken(1, RenX::DelimC))->adminType = adminToken; + } + header.shiftLeft(1); + } + break; case 'l': - if (header.equals("lGAME:")) + if (RenX::Server::rconVersion >= 3) { - if (action.equals("deployed")) + header.shiftRight(1); + Jupiter::ReferenceString subHeader = buff.getToken(1, RenX::DelimC); + if (header.equals("GAME")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString objectType = buff.getToken(3, RenX::DelimC); - if (objectType.match("*Beacon")) player->beaconPlacements++; - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); - onAction(); + if (subHeader.equals("Deployed;")) + { + // Beacon | "by" | Player + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC); + if (objectType.match("*Beacon")) + player->beaconPlacements++; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); + onAction(); + } + else if (subHeader.equals("Disarmed;")) + { + // Beacon | "by" | Player + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC); + if (objectType.match("*Beacon")) + player->beaconPlacements++; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDisarm(this, player, objectType); + onAction(); + } + /*else if (subHeader.equals("Exploded;")) + { + // Explosive | "at" | Location | "by" | Owner + onAction(); + }*/ + else if (subHeader.equals("Captured;")) + { + // Team ',' Building | "by" | Player + Jupiter::ReferenceString teamBuildingToken = buff.getToken(2, RenX::DelimC); + Jupiter::ReferenceString teamToken = teamBuildingToken.getToken(0, ','); + Jupiter::ReferenceString building = teamBuildingToken.getToken(1, ','); + if (building.size() > 2) // temporary fix to remove unique identifier from building token + { + if (building.get(building.size() - 2) == '_') + building.truncate(2); + else if (building.size() > 3 && building.get(building.size() - 3) == '_') + building.truncate(3); + } + TeamType oldTeam = teamToken.isEmpty() ? TeamType::None : RenX::getTeam(teamToken.get(0)); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnCapture(this, player, building, oldTeam); + onAction(); + } + else if (subHeader.equals("Neutralized;")) + { + // Team ',' Building | "by" | Player + Jupiter::ReferenceString teamBuildingToken = buff.getToken(2, RenX::DelimC); + Jupiter::ReferenceString teamToken = teamBuildingToken.getToken(0, ','); + Jupiter::ReferenceString building = teamBuildingToken.getToken(1, ','); + if (building.size() > 2) // temporary fix to remove unique identifier from building token + { + if (building.get(building.size() - 2) == '_') + building.truncate(2); + else if (building.size() > 3 && building.get(building.size() - 3) == '_') + building.truncate(3); + } + TeamType oldTeam = teamToken.isEmpty() ? TeamType::None : RenX::getTeam(teamToken.get(0)); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnNeutralize(this, player, building, oldTeam); + onAction(); + } + else if (subHeader.equals("Death;")) + { + // "player" | Player | "by" | Killer Player | "with" | Damage Type + // "player" | Player | "died by" | Damage Type + // "player" | Player | "suicide by" | Damage Type + // NOTE: Filter these out when Player.isEmpty(). + Jupiter::ReferenceString playerToken = buff.getToken(3, RenX::DelimC); + if (playerToken.isEmpty() == false) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerToken); + Jupiter::ReferenceString type = buff.getToken(4, RenX::DelimC); + Jupiter::ReferenceString damageType; + if (type.equals("by")) + { + damageType = buff.getToken(7, RenX::DelimC); + Jupiter::ReferenceString killerData = buff.getToken(5, RenX::DelimC); + Jupiter::ReferenceString kName = killerData.getToken(2, ','); + Jupiter::ReferenceString kIDToken = killerData.getToken(1, ','); + Jupiter::ReferenceString kTeamToken = killerData.getToken(0, ','); + RenX::TeamType vTeam = TeamType::Other; + if (kTeamToken.isEmpty() == false) + vTeam = RenX::getTeam(kTeamToken.get(0)); + if (kIDToken.equals("ai") || kIDToken.isEmpty()) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnKill(this, kName, vTeam, player, damageType); + else + { + int kID = 0; + bool kIsBot = false; + if (kIDToken.get(0) == 'b') + { + kIsBot = true; + kIDToken.shiftRight(1); + kID = kIDToken.asInt(); + kIDToken.shiftLeft(1); + } + else + kID = kIDToken.asInt(); + RenX::PlayerInfo *victim = getPlayerOrAdd(kName, kID, vTeam, kIsBot, 0, Jupiter::ReferenceString::empty); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnKill(this, player, victim, damageType); + } + } + else if (type.equals("died by")) + { + damageType = buff.getToken(5, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDie(this, player, damageType); + } + else if (type.equals("suicide by")) + { + damageType = buff.getToken(5, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSuicide(this, player, damageType); + } + } + onAction(); + } + else if (subHeader.equals("Stolen;")) + { + // Vehicle | "by" | Player + // Vehicle | "bound to" | Bound Player | "by" | Player + Jupiter::ReferenceString vehicle = buff.getToken(2, RenX::DelimC); + Jupiter::ReferenceString byLine = buff.getToken(3, RenX::DelimC); + if (byLine.equals("by")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSteal(this, player, vehicle); + } + else if (byLine.equals("bound to")) + { + RenX::PlayerInfo *victim = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(6, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSteal(this, player, vehicle, victim); + } + onAction(); + } + else if (subHeader.equals("Destroyed;")) + { + // "vehicle" | Vehicle | "by" | Killer | "with" | Damage Type + // "defence" | Defence | "by" | Killer | "with" | Damage Type + // "emplacement" | Emplacement | "by" | Killer Player | "with" | Damage Type + // "building" | Building | "by" | Killer | "with" | Damage Type + Jupiter::ReferenceString typeToken = buff.getToken(2, RenX::DelimC); + RenX::ObjectType type = ObjectType::None; + if (typeToken.equals("vehicle")) + type = ObjectType::Vehicle; + else if (typeToken.equals("defence") || typeToken.equals("emplacement")) + type = ObjectType::Defence; + else if (typeToken.equals("building")) + type = ObjectType::Building; + + if (type != ObjectType::None) + { + Jupiter::ReferenceString objectName = buff.getToken(3, RenX::DelimC); + if (buff.getToken(4, RenX::DelimC).equals("by")) + { + Jupiter::ReferenceString killerToken = buff.getToken(5, RenX::DelimC); + Jupiter::ReferenceString teamToken = killerToken.getToken(0, ','); + Jupiter::ReferenceString idToken = killerToken.getToken(1, ','); + Jupiter::ReferenceString name = killerToken.gotoToken(2, ','); + Jupiter::ReferenceString damageType = buff.getToken(7, RenX::DelimC); + + RenX::TeamType team = TeamType::Other; + if (teamToken.isEmpty() == false) + team = RenX::getTeam(teamToken.get(0)); + + if (idToken.equals("ai") || idToken.isEmpty()) + { + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDestroy(this, name, team, objectName, RenX::getEnemy(team), damageType, type); + } + else + { + int id; + bool isBot = false; + if (idToken.get(0) == 'b') + { + isBot = true; + idToken.shiftRight(1); + } + id = idToken.asInt(); + RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDestroy(this, player, objectName, damageType, type); + } + } + } + onAction(); + } + else if (subHeader.equals("MatchEnd;")) + { + // "winner" | Winner | Reason("TimeLimit" etc) | "GDI=" GDI Score | "Nod=" Nod Score + // "tie" | Reason | "GDI=" GDI Score | "Nod=" Nod Score + Jupiter::ReferenceString winTieToken = buff.getToken(2, RenX::DelimC); + if (winTieToken.equals("winner")) + { + Jupiter::ReferenceString sWinType = buff.getToken(4, RenX::DelimC); + WinType winType = WinType::Unknown; + if (sWinType.equals("TimeLimit")) + winType = WinType::Score; + else if (sWinType.equals("Buildings")) + winType = WinType::Base; + else if (sWinType.equals("triggered")) + winType = WinType::Shutdown; + + Jupiter::ReferenceString winTeam = buff.getToken(3, RenX::DelimC); + TeamType team = TeamType::Other; + if (winTeam.isEmpty() == false) + team = RenX::getTeam(winTeam.get(0)); + + int gScore = buff.getToken(5, RenX::DelimC).getToken(1, '=').asInt(); + int nScore = buff.getToken(6, RenX::DelimC).getToken(1, '=').asInt(); + + onPreGameOver(winType, team, gScore, nScore); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGameOver(this, winType, team, gScore, nScore); + onPostGameOver(winType, team, gScore, nScore); + } + else if (winTieToken.equals("tie")) + { + int gScore = buff.getToken(4, RenX::DelimC).getToken(1, '=').asInt(); + int nScore = buff.getToken(5, RenX::DelimC).getToken(1, '=').asInt(); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGameOver(this, RenX::WinType::Tie, RenX::TeamType::None, gScore, nScore); + onPostGameOver(WinType::Tie, RenX::TeamType::None, gScore, nScore); + } + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGame(this, raw); + } } - else if (action.equals("suicided by")) + else if (header.equals("CHAT")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - player->deaths++; - player->suicides++; - Jupiter::ReferenceString damageType = buff.getToken(3, RenX::DelimC); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnSuicide(this, player, damageType); - this->firstDeath = true; - onAction(); + if (subHeader.equals("Say;")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + Jupiter::ReferenceString message = buff.getToken(4, RenX::DelimC); + onChat(player, message); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnChat(this, player, message); + onAction(); + } + else if (subHeader.equals("TeamSay;")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + Jupiter::ReferenceString message = buff.getToken(4, RenX::DelimC); + onChat(player, message); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnTeamChat(this, player, message); + onAction(); + } + /*else if (subHeader.equals("AdminSay;")) + { + // Player | "said:" | Message + onAction(); + } + else if (subHeader.equals("ReportSay;")) + { + // Player | "said:" | Message + onAction(); + }*/ + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnOtherChat(this, raw); + } } - else if (action.equals("killed")) + else if (header.equals("PLAYER")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString victimData = buff.getToken(3, RenX::DelimC); - Jupiter::ReferenceString vTeamToken = victimData.getToken(0, ','); - Jupiter::ReferenceString vidToken = victimData.getToken(1, ','); - if (vTeamToken.size() != 0 && vidToken.size() != 0) - { - Jupiter::ReferenceString vname = victimData.getToken(2, ','); - int vid; - bool visBot = false; - if (vidToken[0] == 'b') + if (subHeader.equals("Enter;")) + { + PARSE_PLAYER_DATA_P(buff.getToken(2, RenX::DelimC)); + uint64_t steamid = 0; + if (buff.getToken(5, RenX::DelimC).equals("steamid")) + steamid = buff.getToken(6, RenX::DelimC).asUnsignedLongLong(); + RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, steamid, buff.getToken(4, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnJoin(this, player); + } + else if (subHeader.equals("TeamJoin;")) + { + // Player | "joined" | Team + // Player | "joined" | Team | "left" | Old Team + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + if (buff.tokenCount(RenX::DelimC) > 4) { - vidToken.shiftRight(1); - visBot = true; + Jupiter::ReferenceString oldTeamToken = buff.getToken(6, RenX::DelimC); + RenX::TeamType oldTeam = TeamType::Other; + if (oldTeamToken.isEmpty() == false) + oldTeam = RenX::getTeam(oldTeamToken.get(0)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnTeamChange(this, player, oldTeam); } - vid = vidToken.asInt(10); - TeamType vteam = RenX::getTeam(vTeamToken.get(0)); - Jupiter::ReferenceString damageType = buff.getToken(5, RenX::DelimC); - RenX::PlayerInfo *victim = getPlayerOrAdd(this, vname, vid, vteam, visBot, 0, Jupiter::ReferenceString::empty); - player->kills++; - if (damageType.equals("Rx_DmgType_Headshot")) player->headshots++; - victim->deaths++; - + } + else if (subHeader.equals("Exit;")) + { + // Player + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + if (this->silenceParts == false) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnPart(this, player); + this->removePlayer(player); + } + else if (subHeader.equals("NameChange;")) + { + // Player | "to:" | New Name + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + Jupiter::ReferenceString newName = buff.getToken(3, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnKill(this, player, victim, damageType); + xPlugins.get(i)->RenX_OnNameChange(this, player, newName); + player->name = newName; + onAction(); } - - if (this->needsCList) + else { - this->sendData(STRING_LITERAL_AS_REFERENCE("clogclientlist\n")); - this->needsCList = false; + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnPlayer(this, raw); } - - this->firstKill = true; - this->firstDeath = true; - onAction(); } - else if (action.match("died by")) + else if (header.equals("RCON")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - player->deaths++; - Jupiter::ReferenceString damageType = buff.getToken(3, RenX::DelimC); - if (damageType.equals("DamageType")) + if (subHeader.equals("Command;")) + { + // User | "executed:" | Command + Jupiter::ReferenceString user = buff.getToken(2, RenX::DelimC); + if (buff.getToken(3, RenX::DelimC).equals("executed:")) + { + Jupiter::ReferenceString command = buff.gotoToken(4, RenX::DelimC); + Jupiter::ReferenceString cmd = command.getWord(0, " "); + if (cmd.equalsi("hostsay")) + { + Jupiter::ReferenceString message = command.gotoWord(1, " "); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnHostChat(this, message); + } + else if (cmd.equalsi("hostprivatesay")) + { + RenX::PlayerInfo *player = this->getPlayerByName(command.getWord(1, " ")); + if (player != nullptr) + { + Jupiter::ReferenceString message = command.gotoWord(2, " "); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnHostPage(this, player, message); + } + else + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnExecute(this, user, command); + } + else + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnExecute(this, user, command); + if (this->rconUser.equals(user)) + this->lastCommand = cmd; + } + } + else if (subHeader.equals("Subscribed;")) + { + // User + Jupiter::ReferenceString user = buff.getToken(2, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSubscribe(this, user); + } + else if (subHeader.equals("Unsubscribed;")) + { + // User + Jupiter::ReferenceString user = buff.getToken(2, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnTeamChange(this, player); + xPlugins.get(i)->RenX_OnUnsubscribe(this, user); + } + else if (subHeader.equals("Blocked;")) + { + // User | Reason="(Denied by IP Policy)" / "(Not on Whitelist)" + } + else if (subHeader.equals("Connected;")) + { + // User + } + else if (subHeader.equals("Authenticated;")) + { + // User + } + else if (subHeader.equals("Banned;")) + { + // User | "reason" | Reason="(Too many password attempts)" + } + else if (subHeader.equals("InvalidPassword;")) + { + // User + } + else if (subHeader.equals("Dropped;")) + { + // User | "reason" | Reason="(Auth Timeout)" + } + else if (subHeader.equals("Disconnected;")) + { + // User + } + else if (subHeader.equals("StoppedListen;")) + { + // Reason="(Reached Connection Limit)" + } + else if (subHeader.equals("ResumedListen;")) + { + // Reason="(No longer at Connection Limit)" + } + else if (subHeader.equals("Warning;")) + { + // Warning="(Hit Max Attempt Records - You should investigate Rcon attempts and/or decrease prune time)" + } else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnDie(this, player, damageType); - this->firstDeath = true; - onAction(); + xPlugins.get(i)->RenX_OnRCON(this, raw); + } } - else if (action.match("destroyed*")) + else if (header.equals("ADMIN")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString victim = buff.getToken(3, RenX::DelimC); - Jupiter::ReferenceString damageType = buff.getToken(5, RenX::DelimC); - ObjectType type; - if (action.equals("destroyed building")) + if (subHeader.equals("Rcon;")) { - type = Building; - player->buildingKills++; + // Player | "executed:" | Command + if (buff.getToken(3, RenX::DelimC).equals("executed:")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + Jupiter::ReferenceString cmd = buff.gotoToken(4, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnExecute(this, player, cmd); + } } - else if (victim.match("Rx_Defence_*")) + else if (subHeader.equals("Login;")) { - type = Defence; - player->defenceKills++; + // Player | "as" | Type="moderator" / "administrator" + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + player->adminType = buff.getToken(4, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminLogin(this, player); + } + else if (subHeader.equals("Logout;")) + { + // Player | "as" | Type="moderator" / "administrator" + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminLogout(this, player); + player->adminType = Jupiter::ReferenceString::empty; + } + else if (subHeader.equals("Granted;")) + { + // Player | "as" | Type="moderator" / "administrator" + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(2, RenX::DelimC)); + player->adminType = buff.getToken(4, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminGrant(this, player); } else { - type = Vehicle; - player->vehicleKills++; + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdmin(this, raw); } - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnDestroy(this, player, victim, damageType, type); - onAction(); } - else if (playerData.match("??? wins (*)")) + else if (header.equals("VOTE")) { - TeamType team = RenX::getTeam(playerData[0]); - int gScore = buff.getToken(2, RenX::DelimC).gotoToken(1, '=').asInt(10); - int nScore = buff.getToken(3, RenX::DelimC).gotoToken(1, '=').asInt(10); - Jupiter::ReferenceString winType = Jupiter::ReferenceString::substring(playerData, 10); - winType.truncate(1); - WinType iWinType = Unknown; - if (gScore == nScore) - iWinType = Tie; - else if (winType.equals("TimeLimit")) - iWinType = Score; - else if (winType.equals("Buildings")) - iWinType = Base; - - this->needsCList = true; - if (this->profile->disconnectOnGameOver) - this->silenceParts = true; - - onPreGameOver(this, iWinType, team, gScore, nScore); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGameOver(this, iWinType, team, gScore, nScore); - onPostGameOver(this, iWinType, team, gScore, nScore); - } - else if (playerData.equals("Tie")) - { - int gScore; - switch (RenX::Server::profile->tieFormat) + if (subHeader.equals("Called;")) { - default: - case 1: - gScore = buff.getToken(2, RenX::DelimC).gotoToken(1, '=').asInt(10); - break; - case 0: - gScore = action.gotoToken(1, '=').asInt(10); - break; + // TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "parameters" | Parameters(Empty) | "by" | Player + // TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | "by" | Player + Jupiter::ReferenceString voteType = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString teamToken = buff.getToken(2, RenX::DelimC); + RenX::TeamType team; + if (teamToken.equals("Global")) + team = TeamType::None; + else if (teamToken.equals("GDI")) + team = TeamType::GDI; + else if (teamToken.equals("Nod")) + team = TeamType::Nod; + else + team = TeamType::Other; + + Jupiter::ReferenceString playerToken; + Jupiter::ReferenceString parameters; + if (buff.getToken(4, RenX::DelimC).equals("parameters")) + { + playerToken = buff.getToken(buff.tokenCount(RenX::DelimC) - 1, RenX::DelimC); + parameters = buff.getToken(5, RenX::DelimC); + } + else + playerToken = buff.getToken(5, RenX::DelimC); + + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerToken); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnVoteCall(this, team, voteType, player, parameters); + onAction(); } - int nScore = buff.getToken(3, RenX::DelimC).gotoToken(1, '=').asInt(10); + else if (subHeader.equals("Results;")) + { + // TeamType="Global" / "GDI" / "Nod" / "" | VoteType="Rx_VoteMenuChoice_"... | Success="pass" / "fail" | "Yes=" Yes votes | "No=" No votes + Jupiter::ReferenceString voteType = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString teamToken = buff.getToken(2, RenX::DelimC); + RenX::TeamType team; + if (teamToken.equals("Global")) + team = TeamType::None; + else if (teamToken.equals("GDI")) + team = TeamType::GDI; + else if (teamToken.equals("Nod")) + team = TeamType::Nod; + else + team = TeamType::Other; + + bool success = true; + if (buff.getToken(4, RenX::DelimC).equals("fail")) + success = false; + + int yesVotes = 0; + Jupiter::ReferenceString yesVotesToken = buff.getToken(5, RenX::DelimC); + if (yesVotesToken.size() > 4) + { + yesVotesToken.shiftRight(4); + yesVotes = yesVotesToken.asInt(); + } - this->needsCList = true; - if (this->profile->disconnectOnGameOver) - this->silenceParts = true; + int noVotes = 0; + Jupiter::ReferenceString noVotesToken = buff.getToken(5, RenX::DelimC); + if (yesVotesToken.size() > 3) + { + yesVotesToken.shiftRight(3); + yesVotes = yesVotesToken.asInt(); + } + + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnVoteOver(this, team, voteType, success, yesVotes, noVotes); + } + else if (subHeader.equals("Cancelled;")) + { + // TeamType="Global" / "GDI" / "Nod" | VoteType="Rx_VoteMenuChoice_"... + Jupiter::ReferenceString voteType = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString teamToken = buff.getToken(2, RenX::DelimC); + RenX::TeamType team; + if (teamToken.equals("Global")) + team = TeamType::None; + else if (teamToken.equals("GDI")) + team = TeamType::GDI; + else if (teamToken.equals("Nod")) + team = TeamType::Nod; + else + team = TeamType::Other; - if (gScore == nScore) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnVoteCancel(this, team, voteType); + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnVote(this, raw); + } + } + else if (header.equals("MAP")) + { + if (subHeader.equals("Changing;")) { - onPreGameOver(this, Tie, Other, gScore, nScore); + // Map | Mode="seamless" / "nonseamless" + Jupiter::ReferenceString map = buff.getToken(2, RenX::DelimC); + bool seamless = true; + if (buff.getToken(3, RenX::DelimC).equals("nonseamless")) + { + this->silenceParts = true; + seamless = false; + } for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGameOver(this, Tie, Other, gScore, nScore); - onPostGameOver(this, Tie, Other, gScore, nScore); + xPlugins.get(i)->RenX_OnMapChange(this, map, seamless); + this->map = map; + } + else if (subHeader.equals("Loaded;")) + { + // Map + Jupiter::ReferenceString map = buff.getToken(2, RenX::DelimC); + this->map = map; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnMapLoad(this, map); } else { - TeamType winTeam = gScore > nScore ? RenX::getTeam('G') : RenX::getTeam('N'); - onPreGameOver(this, Shutdown, winTeam, gScore, nScore); + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGameOver(this, Shutdown, winTeam, gScore, nScore); - onPostGameOver(this, Shutdown, winTeam, gScore, nScore); + xPlugins.get(i)->RenX_OnMap(this, raw); } } - else for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGame(this, buff.gotoToken(1, RenX::DelimC)); - } - else if (header.equals("lCHAT:")) - { - if (action.equals("teamsay:")) + else if (header.equals("DEMO")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString message = buff.getToken(3, RenX::DelimC); - onChat(this, player, message, false); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnTeamChat(this, player, message); + if (subHeader.equals("Record;")) + { + // "client request by" | Player + // "admin command by" | Player + // "rcon command" + Jupiter::ReferenceString type = buff.getToken(2, RenX::DelimC); + if (type.equals("client request by") || type.equals("admin command by")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(3, RenX::DelimC)); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDemoRecord(this, player); + } + else + { + Jupiter::ReferenceString user = buff.getToken(3, RenX::DelimC); // not actually used, but here for possible future usage + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDemoRecord(this, user); + } + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDemo(this, raw); + } } - else if (action.equals("say:")) + /*else if (header.equals("ERROR;")) // Decided to disable this entirely, since it's unreachable anyways. { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString message = buff.getToken(3, RenX::DelimC); - onChat(this, player, message, true); + // Should be under RCON. + // "Could not open TCP Port" Port "- Rcon Disabled" + }*/ + else + { + buff.shiftRight(1); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnChat(this, player, message); + xPlugins.get(i)->RenX_OnLog(this, buff); + buff.shiftLeft(1); } - onAction(); } - else if (header.equals("lPLAYER:")) + else // RCONv2 { - PARSE_PLAYER_DATA(); - if (action.equals("disconnected")) + Jupiter::ReferenceString playerData = buff.getToken(1, RenX::DelimC); + Jupiter::ReferenceString action = buff.getToken(2, RenX::DelimC); + if (header.equals("lGAME:")) { - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - if (this->silenceParts == false) + if (action.equals("deployed")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString objectType = buff.getToken(3, RenX::DelimC); + if (objectType.match("*Beacon")) + player->beaconPlacements++; for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnPart(this, player); - this->removePlayer(player); - player = nullptr; - } - else if (action.equals("entered from")) - { - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, buff.getToken(4, RenX::DelimC).equals("steamid") ? buff.getToken(5, RenX::DelimC).asUnsignedLongLong() : 0, buff.getToken(3, RenX::DelimC)); + xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); + onAction(); + } + else if (action.equals("suicided by")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + player->deaths++; + player->suicides++; + Jupiter::ReferenceString damageType = buff.getToken(3, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSuicide(this, player, damageType); + this->firstDeath = true; + onAction(); + } + else if (action.equals("killed")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString victimData = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString vTeamToken = victimData.getToken(0, ','); + Jupiter::ReferenceString vidToken = victimData.getToken(1, ','); + if (vTeamToken.size() != 0 && vidToken.size() != 0) + { + Jupiter::ReferenceString vname = victimData.getToken(2, ','); + int vid; + bool visBot = false; + if (vidToken[0] == 'b') + { + vidToken.shiftRight(1); + visBot = true; + } + vid = vidToken.asInt(10); + TeamType vteam = RenX::getTeam(vTeamToken.get(0)); + Jupiter::ReferenceString damageType = buff.getToken(5, RenX::DelimC); + RenX::PlayerInfo *victim = getPlayerOrAdd(vname, vid, vteam, visBot, 0, Jupiter::ReferenceString::empty); + player->kills++; + if (damageType.equals("Rx_DmgType_Headshot")) player->headshots++; + victim->deaths++; + + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnKill(this, player, victim, damageType); + } + + if (this->needsCList) + { + this->updateClientList(); + this->needsCList = false; + } - if (this->silenceJoins == false) + this->firstKill = true; + this->firstDeath = true; + onAction(); + } + else if (action.match("died by")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + player->deaths++; + Jupiter::ReferenceString damageType = buff.getToken(3, RenX::DelimC); + if (damageType.equals("DamageType")) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnTeamChange(this, player, RenX::getEnemy(player->team)); + else + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnDie(this, player, damageType); + this->firstDeath = true; + onAction(); + } + else if (action.match("destroyed*")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString victim = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString damageType = buff.getToken(5, RenX::DelimC); + ObjectType type; + if (action.equals("destroyed building")) + { + type = ObjectType::Building; + player->buildingKills++; + } + else if (victim.match("Rx_Defence_*")) + { + type = ObjectType::Defence; + player->defenceKills++; + } + else + { + type = ObjectType::Vehicle; + player->vehicleKills++; + } for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnJoin(this, player); + xPlugins.get(i)->RenX_OnDestroy(this, player, victim, damageType, type); + onAction(); + } + else if (playerData.match("??? wins (*)")) + { + TeamType team = RenX::getTeam(playerData[0]); + int gScore = buff.getToken(2, RenX::DelimC).gotoToken(1, '=').asInt(10); + int nScore = buff.getToken(3, RenX::DelimC).gotoToken(1, '=').asInt(10); + Jupiter::ReferenceString winType = Jupiter::ReferenceString::substring(playerData, 10); + winType.truncate(1); + WinType iWinType = WinType::Unknown; + if (gScore == nScore) + iWinType = WinType::Tie; + else if (winType.equals("TimeLimit")) + iWinType = WinType::Score; + else if (winType.equals("Buildings")) + iWinType = WinType::Base; + + this->needsCList = true; + if (this->profile->disconnectOnGameOver) + this->silenceParts = true; + + onPreGameOver(iWinType, team, gScore, nScore); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGameOver(this, iWinType, team, gScore, nScore); + onPostGameOver(iWinType, team, gScore, nScore); + } + else if (playerData.equals("Tie")) + { + int gScore; + switch (RenX::Server::profile->tieFormat) + { + default: + case 1: + gScore = buff.getToken(2, RenX::DelimC).gotoToken(1, '=').asInt(10); + break; + case 0: + gScore = action.gotoToken(1, '=').asInt(10); + break; + } + int nScore = buff.getToken(3, RenX::DelimC).gotoToken(1, '=').asInt(10); + + this->needsCList = true; + if (this->profile->disconnectOnGameOver) + this->silenceParts = true; + + if (gScore == nScore) + { + onPreGameOver(WinType::Tie, TeamType::Other, gScore, nScore); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGameOver(this, WinType::Tie, TeamType::Other, gScore, nScore); + onPostGameOver(WinType::Tie, TeamType::Other, gScore, nScore); + } + else + { + TeamType winTeam = gScore > nScore ? RenX::getTeam('G') : RenX::getTeam('N'); + onPreGameOver(WinType::Shutdown, winTeam, gScore, nScore); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGameOver(this, WinType::Shutdown, winTeam, gScore, nScore); + onPostGameOver(WinType::Shutdown, winTeam, gScore, nScore); + } + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnGame(this, raw); + } } - else if (action.equals("changed name to:")) + else if (header.equals("lCHAT:")) { - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - Jupiter::ReferenceString newName = buff.getToken(3, RenX::DelimC); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnNameChange(this, player, newName); - player->name = newName; - if (RenX::Server::uuidMode == 1) - player->uuid = player->name; + if (action.equals("teamsay:")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString message = buff.getToken(3, RenX::DelimC); + onChat(player, message); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnTeamChat(this, player, message); + } + else if (action.equals("say:")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString message = buff.getToken(3, RenX::DelimC); + onChat(player, message); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnChat(this, player, message); + } onAction(); } - } - else if (header.equals("lRCON:")) - { - if (action.equals("executed:")) - { - Jupiter::ReferenceString command = buff.getToken(3, RenX::DelimC); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnExecute(this, playerData, command); - } - else if (action.equals("subscribed")) - { - if (this->rconUser.isEmpty()) - this->rconUser = playerData; - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnSubscribe(this, playerData); - } - else for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnRCON(this, buff.gotoToken(1, RenX::DelimC)); - } - else if (header.equals("lADMIN:")) - { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - if (action.equals("logged in as")) - { - player->adminType = buff.getToken(3, RenX::DelimC); - if (player->adminType.equalsi("moderator") && player->access < 1) - player->access = 1; - else if (player->adminType.equalsi("administrator") && player->access < 2) - player->access = 2; - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnAdminLogin(this, player); - } - else if (action.equals("logged out of")) + else if (header.equals("lPLAYER:")) { - Jupiter::ReferenceString type = buff.getToken(3, RenX::DelimC); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnAdminLogout(this, player); - player->adminType = ""; - player->access = 0; + if (action.equals("disconnected")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + if (this->silenceParts == false) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnPart(this, player); + this->removePlayer(player); + } + else if (action.equals("entered from")) + { + PARSE_PLAYER_DATA_P(playerData); + RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, buff.getToken(4, RenX::DelimC).equals("steamid") ? buff.getToken(5, RenX::DelimC).asUnsignedLongLong() : 0, buff.getToken(3, RenX::DelimC)); + + if (this->silenceJoins == false) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnJoin(this, player); + } + else if (action.equals("changed name to:")) + { + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + Jupiter::ReferenceString newName = buff.getToken(3, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnNameChange(this, player, newName); + player->name = newName; + if (RenX::Server::uuidMode == 1) + player->uuid = player->name; + onAction(); + } } - else if (action.equals("granted")) + else if (header.equals("lRCON:")) { - player->adminType = buff.getToken(3, RenX::DelimC); - if (player->adminType.equalsi("moderator") && player->access < 1) - player->access = 1; - else if (player->adminType.equalsi("administrator") && player->access < 2) - player->access = 2; - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnAdminGrant(this, player); + if (action.equals("executed:")) + { + Jupiter::ReferenceString command = buff.getToken(3, RenX::DelimC); + Jupiter::ReferenceString cmd = command.getWord(0, " "); + if (cmd.equalsi("say")) + { + Jupiter::ReferenceString message = command.gotoWord(1, " "); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnHostChat(this, message); + } + else if (cmd.equalsi("evaprivatesay")) + { + RenX::PlayerInfo *player = this->getPlayerByName(command.getWord(1, " ")); + if (player != nullptr) + { + Jupiter::ReferenceString message = command.gotoWord(2, " "); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnHostPage(this, player, message); + } + else + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnExecute(this, playerData, command); + } + else + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnExecute(this, playerData, command); + } + else if (action.equals("subscribed")) + { + if (this->rconUser.isEmpty()) + this->rconUser = playerData; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnSubscribe(this, playerData); + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnRCON(this, raw); + } } - else for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnAdmin(this, buff.gotoToken(1, RenX::DelimC)); - } - else if (header.equals("lC-LIST:")) - { - // ID IP SteamID Team Name - if (playerData.isEmpty()) - break; - - static const Jupiter::ReferenceString CListDelim = STRING_LITERAL_AS_REFERENCE(" "); - int id; - bool isBot = false; - if (playerData.get(0) == 'b') + else if (header.equals("lADMIN:")) { - isBot = true; - playerData.shiftRight(1); - id = playerData.asInt(10); - playerData.shiftLeft(1); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(playerData); + if (action.equals("logged in as")) + { + player->adminType = buff.getToken(3, RenX::DelimC); + if (player->adminType.equalsi("moderator") && player->access < 1) + player->access = 1; + else if (player->adminType.equalsi("administrator") && player->access < 2) + player->access = 2; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminLogin(this, player); + } + else if (action.equals("logged out of")) + { + Jupiter::ReferenceString type = buff.getToken(3, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminLogout(this, player); + player->adminType = ""; + player->access = 0; + } + else if (action.equals("granted")) + { + player->adminType = buff.getToken(3, RenX::DelimC); + if (player->adminType.equalsi("moderator") && player->access < 1) + player->access = 1; + else if (player->adminType.equalsi("administrator") && player->access < 2) + player->access = 2; + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdminGrant(this, player); + } + else + { + Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnAdmin(this, raw); + } } - else id = playerData.asInt(10); - Jupiter::ReferenceString ip = playerData.getToken(1, CListDelim); - Jupiter::ReferenceString steamid = playerData.getToken(2, CListDelim); - RenX::TeamType team; - Jupiter::ReferenceString name; - if (steamid.equals("-----NO")) // RCONv2-2a + else if (header.equals("lC-LIST:")) { - steamid = ""; - Jupiter::ReferenceString &teamToken = playerData.getToken(4, CListDelim); - if (teamToken.isEmpty()) + // ID IP SteamID Team Name + if (playerData.isEmpty()) break; - team = getTeam(teamToken.get(0)); - name = playerData.gotoToken(5, CListDelim); + + static const Jupiter::ReferenceString CListDelim = STRING_LITERAL_AS_REFERENCE(" "); + int id; + bool isBot = false; + if (playerData.get(0) == 'b') + { + isBot = true; + playerData.shiftRight(1); + id = playerData.asInt(10); + playerData.shiftLeft(1); + } + else id = playerData.asInt(10); + Jupiter::ReferenceString ip = playerData.getToken(1, CListDelim); + Jupiter::ReferenceString steamid = playerData.getToken(2, CListDelim); + RenX::TeamType team; + Jupiter::ReferenceString name; + if (steamid.equals("-----NO")) // RCONv2-2a + { + steamid = ""; + Jupiter::ReferenceString &teamToken = playerData.getToken(4, CListDelim); + if (teamToken.isEmpty()) + break; + team = getTeam(teamToken.get(0)); + name = playerData.gotoToken(5, CListDelim); + } + else + { + if (steamid.equals("-----NO-STEAM-----")) // RCONv2-2.5a + steamid = ""; + Jupiter::ReferenceString &teamToken = playerData.getToken(3, CListDelim); + if (teamToken.isEmpty()) + break; + team = getTeam(teamToken.get(0)); + name = playerData.gotoToken(4, CListDelim); + } + + RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, steamid.asUnsignedLongLong(), ip); } else { - if (steamid.equals("-----NO-STEAM-----")) // RCONv2-2.5a - steamid = ""; - Jupiter::ReferenceString &teamToken = playerData.getToken(3, CListDelim); - if (teamToken.isEmpty()) - break; - team = getTeam(teamToken.get(0)); - name = playerData.gotoToken(4, CListDelim); + buff.shiftRight(1); + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnLog(this, buff); + buff.shiftLeft(1); } - - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, steamid.asUnsignedLongLong(), ip); - } - else - { - buff.shiftRight(1); - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnLog(this, buff); - buff.shiftLeft(1); } break; @@ -1129,23 +1878,22 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) header.shiftRight(1); { PARSE_PLAYER_DATA_P(header); - PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, playerData.asUnsignedLongLong(0), action); - player->ping = buff.getToken(3, RenX::DelimC).asUnsignedInt() * 4; - player->kills = buff.getToken(4, RenX::DelimC).asUnsignedInt(); - player->deaths = buff.getToken(5, RenX::DelimC).asUnsignedInt(); - player->score = static_cast(buff.getToken(6, RenX::DelimC).asDouble()); - player->credits = static_cast(buff.getToken(7, RenX::DelimC).asDouble()); - player->character = RenX::getCharacter(buff.getToken(8, RenX::DelimC)); + PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, buff.getToken(1, RenX::DelimC).asUnsignedLongLong(0), buff.getToken(2, RenX::DelimC)); + player->ping = buff.getToken(4, RenX::DelimC).asUnsignedInt() * 4; + player->kills = buff.getToken(5, RenX::DelimC).asUnsignedInt(); + player->deaths = buff.getToken(6, RenX::DelimC).asUnsignedInt(); + player->score = static_cast(buff.getToken(7, RenX::DelimC).asDouble()); + player->credits = static_cast(buff.getToken(8, RenX::DelimC).asDouble()); + player->character = RenX::getCharacter(buff.getToken(9, RenX::DelimC)); } header.shiftLeft(1); break; case 2: // Ping, Score, Credits list: Normal Player Data | Ping | Score | Credits header.shiftRight(1); { - PARSE_PLAYER_DATA_P(header); - PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0U, Jupiter::ReferenceString::empty); - player->ping = playerData.asUnsignedInt(); - player->score = static_cast(action.asDouble()); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(header); + player->ping = buff.getToken(1, RenX::DelimC).asUnsignedInt(); + player->score = static_cast(buff.getToken(2, RenX::DelimC).asDouble()); player->credits = static_cast(buff.getToken(3, RenX::DelimC).asDouble()); } header.shiftLeft(1); @@ -1154,11 +1902,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) break; case 4: // Add Credits: Normal Player Data | Credits header.shiftRight(1); - { - PARSE_PLAYER_DATA_P(header); - PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0U, Jupiter::ReferenceString::empty); - player->credits = static_cast(playerData.asDouble()); - } + parseGetPlayerOrAdd(header)->credits = static_cast(buff.getToken(1, RenX::DelimC).asDouble()); header.shiftLeft(1); break; case 5: // Ping: {Average Ping}/{Normal Player Data | Ping} @@ -1168,11 +1912,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) case 7: // Team change: Normal Player Data | Options (00) header.shiftRight(1); { - PARSE_PLAYER_DATA_P(header); - PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0U, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(header); unsigned char options = 0; - if (playerData.isEmpty() == false) - options = playerData.get(0); + Jupiter::ReferenceString optionsToken = buff.getToken(1, RenX::DelimC); + if (optionsToken.isEmpty() == false) + options = optionsToken.get(0); if (options & 0x02) player->credits = 0.0f; if (options & 0x04) @@ -1184,7 +1928,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) player->kills = 0; for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnTeamChange(this, player); + xPlugins.get(i)->RenX_OnTeamChange(this, player, RenX::getEnemy(player->team)); } header.shiftLeft(1); break; @@ -1195,86 +1939,88 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) } else if (header.equals("version")) { - RenX::Server::xRconVersion = playerData.asUnsignedInt(10); - if (this->rconUser.equals(action) == false) - this->rconUser = action; + Jupiter::ReferenceString xVersionToken = buff.getToken(1, RenX::DelimC); + RenX::Server::xRconVersion = xVersionToken.asUnsignedInt(10); + RenX::Server::xRconRevision = xVersionToken.getToken(1, '.').asUnsignedInt(10); + if (this->rconUser.equals(buff.getToken(2, RenX::DelimC)) == false) + this->rconUser = buff.getToken(2, RenX::DelimC); + RenX::Server::serverName = buff.getToken(3, RenX::DelimC); + RenX::Server::map = buff.getToken(4, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_XOnVersion(this, RenX::Server::xRconVersion); - RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("_x\x01\n")); + RenX::Server::updateClientList(); RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("_x\x06\n")); } else if (header.equals("grant_character")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(1, RenX::DelimC)); + Jupiter::ReferenceString character = buff.getToken(2, RenX::DelimC); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGrantCharacter(this, player, action); - player->character = RenX::getCharacter(action); + xPlugins.get(i)->RenX_OnGrantCharacter(this, player, character); + player->character = RenX::getCharacter(character); } else if (header.equals("grant_weapon")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(1, RenX::DelimC)); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnGrantWeapon(this, player, action); + xPlugins.get(i)->RenX_OnGrantWeapon(this, player, buff.getToken(2, RenX::DelimC)); } else if (header.equals("spawn_vehicle")) { - if (playerData.equalsi("buy")) + Jupiter::ReferenceString tok1 = buff.getToken(1, RenX::DelimC); + if (tok1.equalsi("buy")) { - PARSE_PLAYER_DATA_P(buff.getToken(3, RenX::DelimC)); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(3, RenX::DelimC)); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnSpawnVehicle(this, player, action); + xPlugins.get(i)->RenX_OnSpawnVehicle(this, player, buff.getToken(2, RenX::DelimC)); } else { RenX::TeamType team; - if (playerData.isEmpty()) - team = Other; + if (tok1.isEmpty()) + team = TeamType::Other; else - team = RenX::getTeam(playerData.get(0)); + team = RenX::getTeam(tok1.get(0)); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnSpawnVehicleNoOwner(this, team, action); + xPlugins.get(i)->RenX_OnSpawnVehicleNoOwner(this, team, buff.getToken(2, RenX::DelimC)); } } else if (header.equals("mine_place")) { - PARSE_PLAYER_DATA(); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(1, RenX::DelimC)); for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnMinePlace(this, player, action); + xPlugins.get(i)->RenX_OnMinePlace(this, player, buff.getToken(2, RenX::DelimC)); } /*else if (header.equals("mlimit_inc")) { }*/ else if (header.equals("kill")) { + Jupiter::ReferenceString kData = buff.getToken(2, RenX::DelimC); Jupiter::ReferenceString vData = buff.getToken(3, RenX::DelimC); - if (action.isEmpty() == false && vData.isEmpty() == false) // Safety check + if (kData.isEmpty() == false && vData.isEmpty() == false) // Safety check { struct { uint8_t type; // 1 = Player, 2 = Non-Player, 3 = None Jupiter::ReferenceString data; } killerData, victimData; - Jupiter::ReadableString &damageType = playerData; - killerData.type = action[0]; - killerData.data = action.substring(1); + Jupiter::ReadableString &damageType = buff.getToken(1, RenX::DelimC); + killerData.type = kData[0]; + killerData.data = kData.substring(1); victimData.type = vData[0]; victimData.data = vData.substring(1); if (killerData.type == 1) // These are already handled in standard RCON logs; update models and move on. { - { - PARSE_PLAYER_DATA_P(killerData.data.gotoToken(1, ',')); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - player->character = RenX::getCharacter(killerData.data.getToken(0, ',')); - } + RenX::PlayerInfo *player = parseGetPlayerOrAdd(killerData.data.gotoToken(1, ',')); + player->character = RenX::getCharacter(killerData.data.getToken(0, ',')); if (victimData.type == 1) { - PARSE_PLAYER_DATA_P(victimData.data.gotoToken(1, ',')); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); - player->character = RenX::getCharacter(victimData.data.getToken(0, ',')); + if (this->xRconVersion > 1 || this->xRconRevision >= 1 || victimData.data.findi(STRING_LITERAL_AS_REFERENCE("None")) != 0) + { + RenX::PlayerInfo *victim = parseGetPlayerOrAdd(victimData.data.gotoToken(1, ',')); + victim->character = RenX::getCharacter(victimData.data.getToken(0, ',')); + } } } else if (killerData.type == 3) // No killer! @@ -1293,8 +2039,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) killerData.data = killerData.data.gotoToken(1, ','); if (victimData.type == 1) // Non-player killed player { - PARSE_PLAYER_DATA_P(victimData.data.gotoToken(1, ',')); - RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0, Jupiter::ReferenceString::empty); + RenX::PlayerInfo *player = parseGetPlayerOrAdd(victimData.data.gotoToken(1, ',')); player->character = RenX::getCharacter(victimData.data.getToken(0, ',')); for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnKill(this, killerData.data, killerTeam, player, damageType); @@ -1305,11 +2050,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) victimData.data = victimData.data.gotoToken(1, ','); ObjectType type; if (victimData.data.match("Rx_Building_*")) - type = Building; + type = ObjectType::Building; else if (victimData.data.match("Rx_Defence_*")) - type = Defence; + type = ObjectType::Defence; else - type = Vehicle; + type = ObjectType::Vehicle; for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnDestroy(this, killerData.data, killerTeam, victimData.data, victimTeam, damageType, type); } @@ -1352,6 +2097,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) else if (gameVersion.equals("Open Beta 3")) this->profile = RenX::openBeta3Profile; + RenX::Server::updateClientList(); + if (this->profile->disconnectOnGameOver == false) this->firstGame = true; else if (this->firstGame == false) @@ -1367,6 +2114,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) case 'a': buff.shiftRight(1); + if (RenX::Server::rconVersion >= 3) + RenX::Server::rconUser = buff; for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnAuthorized(this, buff); buff.shiftLeft(1); @@ -1399,7 +2148,6 @@ bool RenX::Server::connect() RenX::Server::sock.setBlocking(false); RenX::Server::sock.send(Jupiter::StringS::Format("a%.*s\n", RenX::Server::pass.size(), RenX::Server::pass.ptr())); RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("s\n")); - RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("clogclientlist\n")); RenX::Server::connected = true; RenX::Server::silenceParts = false; return true; @@ -1431,6 +2179,11 @@ unsigned int RenX::Server::getXVersion() const return RenX::Server::xRconVersion; } +unsigned int RenX::Server::getXRevision() const +{ + return RenX::Server::xRconRevision; +} + const Jupiter::ReadableString &RenX::Server::getGameVersion() const { return RenX::Server::gameVersion; @@ -1450,7 +2203,7 @@ RenX::Server::Server(const Jupiter::ReadableString &configurationSection) void RenX::Server::init() { RenX::Server::hostname = Jupiter::IRC::Client::Config->get(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("Hostname"), STRING_LITERAL_AS_REFERENCE("localhost")); - RenX::Server::port = (unsigned short)Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("Port"), 7777); + RenX::Server::port = static_cast(Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("Port"), 7777)); RenX::Server::clientHostname = Jupiter::IRC::Client::Config->get(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("ClientAddress")); RenX::Server::pass = Jupiter::IRC::Client::Config->get(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("Password"), STRING_LITERAL_AS_REFERENCE("renx")); @@ -1461,7 +2214,7 @@ void RenX::Server::init() RenX::Server::setPrefix(Jupiter::IRC::Client::Config->get(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("IRCPrefix"))); RenX::Server::rules = Jupiter::IRC::Client::Config->get(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("Rules"), STRING_LITERAL_AS_REFERENCE("Anarchy!")); - RenX::Server::delay = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("ReconnectDelay"), 60); + RenX::Server::delay = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("ReconnectDelay"), 10); RenX::Server::uuidMode = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("UUIDMode"), 0); RenX::Server::rconBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("RCONBan"), false); RenX::Server::localSteamBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("LocalSteamBan"), true); diff --git a/RenX.Core/RenX_Server.h b/RenX.Core/RenX_Server.h index 6c15dbc..adf29d5 100644 --- a/RenX.Core/RenX_Server.h +++ b/RenX.Core/RenX_Server.h @@ -278,6 +278,13 @@ namespace RenX */ bool removePlayer(RenX::PlayerInfo *player); + /** + * @brief Sends a client list request. + * + * @return True on success, false otherwise. + */ + bool updateClientList(); + /** * @brief Gives a player additional credits, if the server supports it. * @@ -412,6 +419,27 @@ namespace RenX */ const Jupiter::ReadableString &getPassword() const; + /** + * @brief Fetches this connection's RCON user name. + * + * @return String containing the RCON user name. + */ + const Jupiter::ReadableString &getUser() const; + + /** + * @brief Fetches the name of this server. + * + * @return String containing the server name. + */ + const Jupiter::ReadableString &getName() const; + + /** + * @brief Fetches the current map. + * + * @return String containing the current map. + */ + const Jupiter::ReadableString &getMap() const; + /** * @brief Fetches a command from the list. * @@ -530,12 +558,19 @@ namespace RenX unsigned int getVersion() const; /** - * @brief Fetches the eXtended-RCON version number, or 0 or none has been set. + * @brief Fetches the eXtended-RCON version number, or 0 if none has been set. * * @return XRCON version number */ unsigned int getXVersion() const; + /** + * @brief Fetches the eXtended-RCON revision number, or 0 if none has been set. + * + * @return XRCON revision number + */ + unsigned int getXRevision() const; + /** * @brief Fetches the game version string, or an empty string if none has been set. * @@ -577,6 +612,7 @@ namespace RenX bool firstAction = false; unsigned int rconVersion = 0; unsigned int xRconVersion = 0; + unsigned int xRconRevision = 0; time_t lastAttempt = 0; Jupiter::String lastLine; Jupiter::StringS gameVersion; @@ -604,6 +640,9 @@ namespace RenX Jupiter::StringS IRCPrefix; Jupiter::StringS CommandPrefix; Jupiter::StringS rconUser; + Jupiter::StringS serverName; + Jupiter::StringS lastCommand; + Jupiter::StringS map; Jupiter::INIFile::Section *commandAccessLevels; Jupiter::INIFile::Section *commandAliases; }; diff --git a/RenX.Core/RenX_Tags.cpp b/RenX.Core/RenX_Tags.cpp index 464fd73..3e264d8 100644 --- a/RenX.Core/RenX_Tags.cpp +++ b/RenX.Core/RenX_Tags.cpp @@ -30,11 +30,28 @@ struct TagsImp : RenX::Tags TagsImp(); void processTags(Jupiter::StringType &msg, const RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim); void sanitizeTags(Jupiter::StringType &fmt); + const Jupiter::ReadableString &getUniqueInternalTag(); +private: + Jupiter::StringS uniqueTag; + union + { + uint32_t tagItr; + struct + { + uint8_t tagItrP1; + uint8_t tagItrP2; + uint8_t tagItrP3; + uint8_t tagItrP4; + }; + }; } _tags; RenX::Tags *RenX::tags = &_tags; TagsImp::TagsImp() { + this->tagItr = 0; + this->uniqueTag = STRING_LITERAL_AS_REFERENCE("\0\0\0\0\0\0"); + const Jupiter::ReadableString &configSection = Jupiter::IRC::Client::Config->get(STRING_LITERAL_AS_REFERENCE("RenX"), STRING_LITERAL_AS_REFERENCE("TagDefinitions"), STRING_LITERAL_AS_REFERENCE("RenX.Tags")); /** Global formats */ @@ -44,84 +61,87 @@ TagsImp::TagsImp() /** Internal message tags */ /** Global tags */ - this->INTERNAL_DATE_TAG = STRING_LITERAL_AS_REFERENCE("\0DAT\0"); - this->INTERNAL_TIME_TAG = STRING_LITERAL_AS_REFERENCE("\0TIM\0"); + this->INTERNAL_DATE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_TIME_TAG = this->getUniqueInternalTag(); /** Server tags */ - this->INTERNAL_RCON_VERSION_TAG = STRING_LITERAL_AS_REFERENCE("\0RVER\0"); - this->INTERNAL_GAME_VERSION_TAG = STRING_LITERAL_AS_REFERENCE("\0GVER\0"); - this->INTERNAL_XRCON_VERSION_TAG = STRING_LITERAL_AS_REFERENCE("\0XVER\0"); - this->INTERNAL_RULES_TAG = STRING_LITERAL_AS_REFERENCE("\0RUL\0"); + this->INTERNAL_RCON_VERSION_TAG = this->getUniqueInternalTag(); + this->INTERNAL_GAME_VERSION_TAG = this->getUniqueInternalTag(); + this->INTERNAL_XRCON_VERSION_TAG = this->getUniqueInternalTag(); + this->INTERNAL_RULES_TAG = this->getUniqueInternalTag(); + this->INTERNAL_USER_TAG = this->getUniqueInternalTag(); + this->INTERNAL_SERVER_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_MAP_TAG = this->getUniqueInternalTag(); /** Player tags*/ - this->INTERNAL_NAME_TAG = STRING_LITERAL_AS_REFERENCE("\0NAME\0"); - this->INTERNAL_RAW_NAME_TAG = STRING_LITERAL_AS_REFERENCE("\0RNAME\0"); - this->INTERNAL_IP_TAG = STRING_LITERAL_AS_REFERENCE("\0IP\0"); - this->INTERNAL_STEAM_TAG = STRING_LITERAL_AS_REFERENCE("\0STEAM\0"); - this->INTERNAL_UUID_TAG = STRING_LITERAL_AS_REFERENCE("\0UUID\0"); - this->INTERNAL_ID_TAG = STRING_LITERAL_AS_REFERENCE("\0ID\0"); - this->INTERNAL_CHARACTER_TAG = STRING_LITERAL_AS_REFERENCE("\0CHR\0"); - this->INTERNAL_VEHICLE_TAG = STRING_LITERAL_AS_REFERENCE("\0VEH\0"); - this->INTERNAL_ADMIN_TAG = STRING_LITERAL_AS_REFERENCE("\0ADM\0"); - this->INTERNAL_PREFIX_TAG = STRING_LITERAL_AS_REFERENCE("\0PFX\0"); - this->INTERNAL_GAME_PREFIX_TAG = STRING_LITERAL_AS_REFERENCE("\0GPF\0"); - this->INTERNAL_TEAM_COLOR_TAG = STRING_LITERAL_AS_REFERENCE("\0TC\0"); - this->INTERNAL_TEAM_SHORT_TAG = STRING_LITERAL_AS_REFERENCE("\0TS\0"); - this->INTERNAL_TEAM_LONG_TAG = STRING_LITERAL_AS_REFERENCE("\0TL\0"); - this->INTERNAL_PING_TAG = STRING_LITERAL_AS_REFERENCE("\0PNG\0"); - this->INTERNAL_SCORE_TAG = STRING_LITERAL_AS_REFERENCE("\0SCR\0"); - this->INTERNAL_CREDITS_TAG = STRING_LITERAL_AS_REFERENCE("\0CRD\0"); - this->INTERNAL_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0KIL\0"); - this->INTERNAL_DEATHS_TAG = STRING_LITERAL_AS_REFERENCE("\0DTH\0"); - this->INTERNAL_KDR_TAG = STRING_LITERAL_AS_REFERENCE("\0KDR\0"); - this->INTERNAL_SUICIDES_TAG = STRING_LITERAL_AS_REFERENCE("\0SCD\0"); - this->INTERNAL_HEADSHOTS_TAG = STRING_LITERAL_AS_REFERENCE("\0HDS\0"); - this->INTERNAL_VEHICLE_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0VKS\0"); - this->INTERNAL_BUILDING_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0BKS\0"); - this->INTERNAL_DEFENCE_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0DKS\0"); - this->INTERNAL_WINS_TAG = STRING_LITERAL_AS_REFERENCE("\0WIN\0"); - this->INTERNAL_LOSES_TAG = STRING_LITERAL_AS_REFERENCE("\0LOS\0"); - this->INTERNAL_BEACON_PLACEMENTS_TAG = STRING_LITERAL_AS_REFERENCE("\0BPC\0"); - this->INTERNAL_ACCESS_TAG = STRING_LITERAL_AS_REFERENCE("\0ACS\0"); + this->INTERNAL_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_RAW_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_IP_TAG = this->getUniqueInternalTag(); + this->INTERNAL_STEAM_TAG = this->getUniqueInternalTag(); + this->INTERNAL_UUID_TAG = this->getUniqueInternalTag(); + this->INTERNAL_ID_TAG = this->getUniqueInternalTag(); + this->INTERNAL_CHARACTER_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VEHICLE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_ADMIN_TAG = this->getUniqueInternalTag(); + this->INTERNAL_PREFIX_TAG = this->getUniqueInternalTag(); + this->INTERNAL_GAME_PREFIX_TAG = this->getUniqueInternalTag(); + this->INTERNAL_TEAM_COLOR_TAG = this->getUniqueInternalTag(); + this->INTERNAL_TEAM_SHORT_TAG = this->getUniqueInternalTag(); + this->INTERNAL_TEAM_LONG_TAG = this->getUniqueInternalTag(); + this->INTERNAL_PING_TAG = this->getUniqueInternalTag(); + this->INTERNAL_SCORE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_CREDITS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_DEATHS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_KDR_TAG = this->getUniqueInternalTag(); + this->INTERNAL_SUICIDES_TAG = this->getUniqueInternalTag(); + this->INTERNAL_HEADSHOTS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VEHICLE_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_BUILDING_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_DEFENCE_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_WINS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_LOSES_TAG = this->getUniqueInternalTag(); + this->INTERNAL_BEACON_PLACEMENTS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_ACCESS_TAG = this->getUniqueInternalTag(); /** Victim tags */ - this->INTERNAL_VICTIM_NAME_TAG = STRING_LITERAL_AS_REFERENCE("\0VNAME\0"); - this->INTERNAL_VICTIM_RAW_NAME_TAG = STRING_LITERAL_AS_REFERENCE("\0VRNAME\0"); - this->INTERNAL_VICTIM_IP_TAG = STRING_LITERAL_AS_REFERENCE("\0VIP\0"); - this->INTERNAL_VICTIM_STEAM_TAG = STRING_LITERAL_AS_REFERENCE("\0VSTEAM\0"); - this->INTERNAL_VICTIM_UUID_TAG = STRING_LITERAL_AS_REFERENCE("\0VUUID\0"); - this->INTERNAL_VICTIM_ID_TAG = STRING_LITERAL_AS_REFERENCE("\0VID\0"); - this->INTERNAL_VICTIM_CHARACTER_TAG = STRING_LITERAL_AS_REFERENCE("\0VCHR\0"); - this->INTERNAL_VICTIM_VEHICLE_TAG = STRING_LITERAL_AS_REFERENCE("\0VVEH\0"); - this->INTERNAL_VICTIM_ADMIN_TAG = STRING_LITERAL_AS_REFERENCE("\0VADM\0"); - this->INTERNAL_VICTIM_PREFIX_TAG = STRING_LITERAL_AS_REFERENCE("\0VPFX\0"); - this->INTERNAL_VICTIM_GAME_PREFIX_TAG = STRING_LITERAL_AS_REFERENCE("\0VGPF\0"); - this->INTERNAL_VICTIM_TEAM_COLOR_TAG = STRING_LITERAL_AS_REFERENCE("\0VTC\0"); - this->INTERNAL_VICTIM_TEAM_SHORT_TAG = STRING_LITERAL_AS_REFERENCE("\0VTS\0"); - this->INTERNAL_VICTIM_TEAM_LONG_TAG = STRING_LITERAL_AS_REFERENCE("\0VTL\0"); - this->INTERNAL_VICTIM_PING_TAG = STRING_LITERAL_AS_REFERENCE("\0VPNG\0"); - this->INTERNAL_VICTIM_SCORE_TAG = STRING_LITERAL_AS_REFERENCE("\0VSCR\0"); - this->INTERNAL_VICTIM_CREDITS_TAG = STRING_LITERAL_AS_REFERENCE("\0VCRD\0"); - this->INTERNAL_VICTIM_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0VKIL\0"); - this->INTERNAL_VICTIM_DEATHS_TAG = STRING_LITERAL_AS_REFERENCE("\0VDTH\0"); - this->INTERNAL_VICTIM_KDR_TAG = STRING_LITERAL_AS_REFERENCE("\0VKDR\0"); - this->INTERNAL_VICTIM_SUICIDES_TAG = STRING_LITERAL_AS_REFERENCE("\0VSCD\0"); - this->INTERNAL_VICTIM_HEADSHOTS_TAG = STRING_LITERAL_AS_REFERENCE("\0VHDS\0"); - this->INTERNAL_VICTIM_VEHICLE_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0VVKS\0"); - this->INTERNAL_VICTIM_BUILDING_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0VBKS\0"); - this->INTERNAL_VICTIM_DEFENCE_KILLS_TAG = STRING_LITERAL_AS_REFERENCE("\0VDKS\0"); - this->INTERNAL_VICTIM_WINS_TAG = STRING_LITERAL_AS_REFERENCE("\0VWIN\0"); - this->INTERNAL_VICTIM_LOSES_TAG = STRING_LITERAL_AS_REFERENCE("\0VLOS\0"); - this->INTERNAL_VICTIM_BEACON_PLACEMENTS_TAG = STRING_LITERAL_AS_REFERENCE("\0VBPC\0"); - this->INTERNAL_VICTIM_ACCESS_TAG = STRING_LITERAL_AS_REFERENCE("\0VACS\0"); + this->INTERNAL_VICTIM_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_RAW_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_IP_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_STEAM_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_UUID_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_ID_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_CHARACTER_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_VEHICLE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_ADMIN_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_PREFIX_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_GAME_PREFIX_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_TEAM_COLOR_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_TEAM_SHORT_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_TEAM_LONG_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_PING_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_SCORE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_CREDITS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_DEATHS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_KDR_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_SUICIDES_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_HEADSHOTS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_VEHICLE_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_BUILDING_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_DEFENCE_KILLS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_WINS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_LOSES_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_BEACON_PLACEMENTS_TAG = this->getUniqueInternalTag(); + this->INTERNAL_VICTIM_ACCESS_TAG = this->getUniqueInternalTag(); /** Other tags */ - this->INTERNAL_WEAPON_TAG = STRING_LITERAL_AS_REFERENCE("\0WEP\0"); - this->INTERNAL_OBJECT_TAG = STRING_LITERAL_AS_REFERENCE("\0OBJ\0"); - this->INTERNAL_MESSAGE_TAG = STRING_LITERAL_AS_REFERENCE("\0MSG\0"); - this->INTERNAL_NEW_NAME_TAG = STRING_LITERAL_AS_REFERENCE("\0NNAME\0"); - this->INTERNAL_WIN_SCORE_TAG = STRING_LITERAL_AS_REFERENCE("\0WSC\0"); - this->INTERNAL_LOSE_SCORE_TAG = STRING_LITERAL_AS_REFERENCE("\0LSC\0"); + this->INTERNAL_WEAPON_TAG = this->getUniqueInternalTag(); + this->INTERNAL_OBJECT_TAG = this->getUniqueInternalTag(); + this->INTERNAL_MESSAGE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_NEW_NAME_TAG = this->getUniqueInternalTag(); + this->INTERNAL_WIN_SCORE_TAG = this->getUniqueInternalTag(); + this->INTERNAL_LOSE_SCORE_TAG = this->getUniqueInternalTag(); /** External (config) tags */ @@ -134,6 +154,9 @@ TagsImp::TagsImp() this->gameVersionTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("GameVersionTag"), STRING_LITERAL_AS_REFERENCE("{GVER}")); this->xRconVersionTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("XRCONVersionTag"), STRING_LITERAL_AS_REFERENCE("{XVER}")); this->rulesTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("RulesTag"), STRING_LITERAL_AS_REFERENCE("{RULES}")); + this->userTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("UserTag"), STRING_LITERAL_AS_REFERENCE("{USER}")); + this->serverNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("ServerNameTag"), STRING_LITERAL_AS_REFERENCE("{SERVERNAME}")); + this->mapTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("MapTag"), STRING_LITERAL_AS_REFERENCE("{MAP}")); /** Player tags */ this->nameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("NameTag"), STRING_LITERAL_AS_REFERENCE("{NAME}")); @@ -214,8 +237,11 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server, { msg.replace(this->INTERNAL_RCON_VERSION_TAG, Jupiter::StringS::Format("%u", server->getVersion())); msg.replace(this->INTERNAL_GAME_VERSION_TAG, server->getGameVersion()); - msg.replace(this->INTERNAL_XRCON_VERSION_TAG, Jupiter::StringS::Format("%u", server->getXVersion())); + msg.replace(this->INTERNAL_XRCON_VERSION_TAG, Jupiter::StringS::Format("%u.%u", server->getXVersion(), server->getXRevision())); msg.replace(this->INTERNAL_RULES_TAG, server->getRules()); + msg.replace(this->INTERNAL_USER_TAG, server->getUser()); + msg.replace(this->INTERNAL_SERVER_NAME_TAG, server->getName()); + msg.replace(this->INTERNAL_MAP_TAG, server->getMap()); if (player != nullptr) { msg.replace(this->INTERNAL_STEAM_TAG, server->formatSteamID(player)); @@ -304,6 +330,9 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt) fmt.replace(this->gameVersionTag, this->INTERNAL_GAME_VERSION_TAG); fmt.replace(this->xRconVersionTag, this->INTERNAL_XRCON_VERSION_TAG); fmt.replace(this->rulesTag, this->INTERNAL_RULES_TAG); + fmt.replace(this->userTag, this->INTERNAL_USER_TAG); + fmt.replace(this->serverNameTag, this->INTERNAL_SERVER_NAME_TAG); + fmt.replace(this->mapTag, this->INTERNAL_MAP_TAG); /** Player tags */ fmt.replace(this->nameTag, this->INTERNAL_NAME_TAG); @@ -380,6 +409,16 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt) xPlugins.get(i)->RenX_SanitizeTags(fmt); } +const Jupiter::ReadableString &TagsImp::getUniqueInternalTag() +{ + this->uniqueTag.set(1, this->tagItrP1); + this->uniqueTag.set(2, this->tagItrP2); + this->uniqueTag.set(3, this->tagItrP3); + this->uniqueTag.set(4, this->tagItrP4); + this->tagItr++; + return this->uniqueTag; +} + /** Foward functions */ void RenX::processTags(Jupiter::StringType &msg, const RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim) diff --git a/RenX.Core/RenX_Tags.h b/RenX.Core/RenX_Tags.h index 5915d8f..df5f49a 100644 --- a/RenX.Core/RenX_Tags.h +++ b/RenX.Core/RenX_Tags.h @@ -51,84 +51,87 @@ namespace RenX /** Internal message tags */ /** Global tags */ - Jupiter::ReferenceString INTERNAL_DATE_TAG; - Jupiter::ReferenceString INTERNAL_TIME_TAG; + Jupiter::StringS INTERNAL_DATE_TAG; + Jupiter::StringS INTERNAL_TIME_TAG; /** Server tags */ - Jupiter::ReferenceString INTERNAL_RCON_VERSION_TAG; - Jupiter::ReferenceString INTERNAL_GAME_VERSION_TAG; - Jupiter::ReferenceString INTERNAL_XRCON_VERSION_TAG; - Jupiter::ReferenceString INTERNAL_RULES_TAG; + Jupiter::StringS INTERNAL_RCON_VERSION_TAG; + Jupiter::StringS INTERNAL_GAME_VERSION_TAG; + Jupiter::StringS INTERNAL_XRCON_VERSION_TAG; + Jupiter::StringS INTERNAL_RULES_TAG; + Jupiter::StringS INTERNAL_USER_TAG; + Jupiter::StringS INTERNAL_SERVER_NAME_TAG; + Jupiter::StringS INTERNAL_MAP_TAG; /** Player tags */ - Jupiter::ReferenceString INTERNAL_NAME_TAG; - Jupiter::ReferenceString INTERNAL_RAW_NAME_TAG; - Jupiter::ReferenceString INTERNAL_IP_TAG; - Jupiter::ReferenceString INTERNAL_STEAM_TAG; - Jupiter::ReferenceString INTERNAL_UUID_TAG; - Jupiter::ReferenceString INTERNAL_ID_TAG; - Jupiter::ReferenceString INTERNAL_CHARACTER_TAG; - Jupiter::ReferenceString INTERNAL_VEHICLE_TAG; - Jupiter::ReferenceString INTERNAL_ADMIN_TAG; - Jupiter::ReferenceString INTERNAL_PREFIX_TAG; - Jupiter::ReferenceString INTERNAL_GAME_PREFIX_TAG; - Jupiter::ReferenceString INTERNAL_TEAM_COLOR_TAG; - Jupiter::ReferenceString INTERNAL_TEAM_SHORT_TAG; - Jupiter::ReferenceString INTERNAL_TEAM_LONG_TAG; - Jupiter::ReferenceString INTERNAL_PING_TAG; - Jupiter::ReferenceString INTERNAL_SCORE_TAG; - Jupiter::ReferenceString INTERNAL_CREDITS_TAG; - Jupiter::ReferenceString INTERNAL_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_DEATHS_TAG; - Jupiter::ReferenceString INTERNAL_KDR_TAG; - Jupiter::ReferenceString INTERNAL_SUICIDES_TAG; - Jupiter::ReferenceString INTERNAL_HEADSHOTS_TAG; - Jupiter::ReferenceString INTERNAL_VEHICLE_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_BUILDING_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_DEFENCE_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_WINS_TAG; - Jupiter::ReferenceString INTERNAL_LOSES_TAG; - Jupiter::ReferenceString INTERNAL_BEACON_PLACEMENTS_TAG; - Jupiter::ReferenceString INTERNAL_ACCESS_TAG; + Jupiter::StringS INTERNAL_NAME_TAG; + Jupiter::StringS INTERNAL_RAW_NAME_TAG; + Jupiter::StringS INTERNAL_IP_TAG; + Jupiter::StringS INTERNAL_STEAM_TAG; + Jupiter::StringS INTERNAL_UUID_TAG; + Jupiter::StringS INTERNAL_ID_TAG; + Jupiter::StringS INTERNAL_CHARACTER_TAG; + Jupiter::StringS INTERNAL_VEHICLE_TAG; + Jupiter::StringS INTERNAL_ADMIN_TAG; + Jupiter::StringS INTERNAL_PREFIX_TAG; + Jupiter::StringS INTERNAL_GAME_PREFIX_TAG; + Jupiter::StringS INTERNAL_TEAM_COLOR_TAG; + Jupiter::StringS INTERNAL_TEAM_SHORT_TAG; + Jupiter::StringS INTERNAL_TEAM_LONG_TAG; + Jupiter::StringS INTERNAL_PING_TAG; + Jupiter::StringS INTERNAL_SCORE_TAG; + Jupiter::StringS INTERNAL_CREDITS_TAG; + Jupiter::StringS INTERNAL_KILLS_TAG; + Jupiter::StringS INTERNAL_DEATHS_TAG; + Jupiter::StringS INTERNAL_KDR_TAG; + Jupiter::StringS INTERNAL_SUICIDES_TAG; + Jupiter::StringS INTERNAL_HEADSHOTS_TAG; + Jupiter::StringS INTERNAL_VEHICLE_KILLS_TAG; + Jupiter::StringS INTERNAL_BUILDING_KILLS_TAG; + Jupiter::StringS INTERNAL_DEFENCE_KILLS_TAG; + Jupiter::StringS INTERNAL_WINS_TAG; + Jupiter::StringS INTERNAL_LOSES_TAG; + Jupiter::StringS INTERNAL_BEACON_PLACEMENTS_TAG; + Jupiter::StringS INTERNAL_ACCESS_TAG; /** Victim tags */ - Jupiter::ReferenceString INTERNAL_VICTIM_NAME_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_RAW_NAME_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_IP_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_STEAM_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_UUID_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_ID_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_CHARACTER_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_VEHICLE_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_ADMIN_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_PREFIX_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_GAME_PREFIX_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_TEAM_COLOR_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_TEAM_SHORT_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_TEAM_LONG_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_PING_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_SCORE_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_CREDITS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_DEATHS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_KDR_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_SUICIDES_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_HEADSHOTS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_VEHICLE_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_BUILDING_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_DEFENCE_KILLS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_WINS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_LOSES_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_BEACON_PLACEMENTS_TAG; - Jupiter::ReferenceString INTERNAL_VICTIM_ACCESS_TAG; + Jupiter::StringS INTERNAL_VICTIM_NAME_TAG; + Jupiter::StringS INTERNAL_VICTIM_RAW_NAME_TAG; + Jupiter::StringS INTERNAL_VICTIM_IP_TAG; + Jupiter::StringS INTERNAL_VICTIM_STEAM_TAG; + Jupiter::StringS INTERNAL_VICTIM_UUID_TAG; + Jupiter::StringS INTERNAL_VICTIM_ID_TAG; + Jupiter::StringS INTERNAL_VICTIM_CHARACTER_TAG; + Jupiter::StringS INTERNAL_VICTIM_VEHICLE_TAG; + Jupiter::StringS INTERNAL_VICTIM_ADMIN_TAG; + Jupiter::StringS INTERNAL_VICTIM_PREFIX_TAG; + Jupiter::StringS INTERNAL_VICTIM_GAME_PREFIX_TAG; + Jupiter::StringS INTERNAL_VICTIM_TEAM_COLOR_TAG; + Jupiter::StringS INTERNAL_VICTIM_TEAM_SHORT_TAG; + Jupiter::StringS INTERNAL_VICTIM_TEAM_LONG_TAG; + Jupiter::StringS INTERNAL_VICTIM_PING_TAG; + Jupiter::StringS INTERNAL_VICTIM_SCORE_TAG; + Jupiter::StringS INTERNAL_VICTIM_CREDITS_TAG; + Jupiter::StringS INTERNAL_VICTIM_KILLS_TAG; + Jupiter::StringS INTERNAL_VICTIM_DEATHS_TAG; + Jupiter::StringS INTERNAL_VICTIM_KDR_TAG; + Jupiter::StringS INTERNAL_VICTIM_SUICIDES_TAG; + Jupiter::StringS INTERNAL_VICTIM_HEADSHOTS_TAG; + Jupiter::StringS INTERNAL_VICTIM_VEHICLE_KILLS_TAG; + Jupiter::StringS INTERNAL_VICTIM_BUILDING_KILLS_TAG; + Jupiter::StringS INTERNAL_VICTIM_DEFENCE_KILLS_TAG; + Jupiter::StringS INTERNAL_VICTIM_WINS_TAG; + Jupiter::StringS INTERNAL_VICTIM_LOSES_TAG; + Jupiter::StringS INTERNAL_VICTIM_BEACON_PLACEMENTS_TAG; + Jupiter::StringS INTERNAL_VICTIM_ACCESS_TAG; /** Other tags */ - Jupiter::ReferenceString INTERNAL_WEAPON_TAG; - Jupiter::ReferenceString INTERNAL_OBJECT_TAG; - Jupiter::ReferenceString INTERNAL_MESSAGE_TAG; - Jupiter::ReferenceString INTERNAL_NEW_NAME_TAG; - Jupiter::ReferenceString INTERNAL_WIN_SCORE_TAG; - Jupiter::ReferenceString INTERNAL_LOSE_SCORE_TAG; + Jupiter::StringS INTERNAL_WEAPON_TAG; + Jupiter::StringS INTERNAL_OBJECT_TAG; + Jupiter::StringS INTERNAL_MESSAGE_TAG; + Jupiter::StringS INTERNAL_NEW_NAME_TAG; + Jupiter::StringS INTERNAL_WIN_SCORE_TAG; + Jupiter::StringS INTERNAL_LOSE_SCORE_TAG; /** External message tags */ @@ -141,6 +144,9 @@ namespace RenX Jupiter::StringS gameVersionTag; Jupiter::StringS xRconVersionTag; Jupiter::StringS rulesTag; + Jupiter::StringS userTag; + Jupiter::StringS serverNameTag; + Jupiter::StringS mapTag; /** Player tags */ Jupiter::StringS nameTag; diff --git a/RenX.Logging/RenX_Logging.cpp b/RenX.Logging/RenX_Logging.cpp index c9e7ce5..0beace1 100644 --- a/RenX.Logging/RenX_Logging.cpp +++ b/RenX.Logging/RenX_Logging.cpp @@ -1,5 +1,5 @@ /** - * Copyright (C) 2014 Justin James. + * Copyright (C) 2014-2015 Justin James. * * This license must be preserved. * Any applications, libraries, or code which make any use of any @@ -30,13 +30,21 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::partPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PartPublic"), true); RenX_LoggingPlugin::nameChangePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("NameChangePublic"), true); RenX_LoggingPlugin::teamChangePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TeamChangePublic"), true); + RenX_LoggingPlugin::playerPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PlayerPublic"), false); RenX_LoggingPlugin::chatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("ChatPublic"), true); RenX_LoggingPlugin::teamChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TeamChatPublic"), true); + RenX_LoggingPlugin::hostChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("HostChatPublic"), true); + RenX_LoggingPlugin::hostPagePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("HostPagePublic"), false); + RenX_LoggingPlugin::otherChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("OtherChatPublic"), false); RenX_LoggingPlugin::deployPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DeployPublic"), true); + RenX_LoggingPlugin::disarmPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DisarmPublic"), true); RenX_LoggingPlugin::suicidePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("SuicidePublic"), true); RenX_LoggingPlugin::killPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("KillPublic"), true); RenX_LoggingPlugin::diePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DiePublic"), true); RenX_LoggingPlugin::destroyPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DestroyPublic"), true); + RenX_LoggingPlugin::capturePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("CapturePublic"), true); + RenX_LoggingPlugin::neutralizePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("NeutralizePublic"), true); + RenX_LoggingPlugin::stealPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("StealPublic"), true); RenX_LoggingPlugin::gamePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("GamePublic"), true); RenX_LoggingPlugin::gameOverPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("GameOverPublic"), true); RenX_LoggingPlugin::executePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("ExecutePublic"), false); @@ -46,6 +54,15 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::adminGrantPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminGrantPublic"), true); RenX_LoggingPlugin::adminLogoutPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminLogoutPublic"), true); RenX_LoggingPlugin::adminPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminPublic"), false); + RenX_LoggingPlugin::voteCallPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VoteCallPublic"), true); + RenX_LoggingPlugin::voteOverPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VoteOverPublic"), true); + RenX_LoggingPlugin::voteCancelPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VoteCancelPublic"), true); + RenX_LoggingPlugin::votePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VotePublic"), false); + RenX_LoggingPlugin::mapChangePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapChangePublic"), true); + RenX_LoggingPlugin::mapLoadPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapLoadPublic"), true); + RenX_LoggingPlugin::mapPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapPublic"), false); + RenX_LoggingPlugin::demoRecordPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DemoRecordPublic"), true); + RenX_LoggingPlugin::demoPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DemoPublic"), false); RenX_LoggingPlugin::logPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("LogPublic"), false); RenX_LoggingPlugin::xVersionPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("XVersionPublic"), true); RenX_LoggingPlugin::grantCharacterPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("GrantCharacterPublic"), false); @@ -72,6 +89,12 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::partFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("PartFormat"), Jupiter::StringS::Format(IRCCOLOR "12[Part] " IRCBOLD "%.*s" IRCBOLD " left the %.*s.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr())); + RenX_LoggingPlugin::playerExecuteFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("PlayerExecuteFormat"), + Jupiter::StringS::Format("%.*s" IRCCOLOR "07 executed: %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::playerFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("PlayerFormat"), + Jupiter::StringS::Format(IRCCOLOR "12[Player]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::nameChangeFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("NameChangeFormat"), Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD " changed their name to " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->newNameTag.size(), RenX::tags->newNameTag.ptr())); @@ -84,9 +107,21 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::teamChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("TeamChatFormat"), Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD ": %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::hostChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("HostChatFormat"), + Jupiter::StringS::Format(IRCCOLOR "12Host" IRCCOLOR "0: %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::hostPageFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("HostPageFormat"), + Jupiter::StringS::Format(IRCCOLOR "12(Host -> %.*s): %.*s", RenX::tags->rawNameTag.size(), RenX::tags->rawNameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::otherChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("OtherChatFormat"), + Jupiter::StringS::Format(IRCCOLOR "06[Other Chat]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::deployFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DeployFormat"), Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD " deployed a " IRCBOLD "%.*s" IRCBOLD, RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr())); + RenX_LoggingPlugin::disarmFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DisarmFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD " disarmed a " IRCBOLD "%.*s" IRCBOLD, RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr())); + RenX_LoggingPlugin::suicideFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("SuicideFormat"), Jupiter::StringS::Format("%.*s" IRCCOLOR " suicided (death by " IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->weaponTag.size(), RenX::tags->weaponTag.ptr())); @@ -120,6 +155,18 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::destroyVehicleFmt2 = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DestroyVehicleFormat2"), Jupiter::StringS::Format(IRCCOLOR "%.*s%.*s" IRCCOLOR " destroyed a " IRCCOLOR "%.*s%.*s" IRCCOLOR " (" IRCCOLOR "12%.*s" IRCCOLOR ").", RenX::tags->teamColorTag.size(), RenX::tags->teamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->weaponTag.size(), RenX::tags->weaponTag.ptr())); + RenX_LoggingPlugin::captureFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("CaptureFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD " captured the " IRCBOLD IRCCOLOR "%.*s%.*s" IRCBOLD ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr())); + + RenX_LoggingPlugin::neutralizeFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("NeutralizeFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD " neutralized the " IRCBOLD IRCCOLOR "%.*s%.*s" IRCBOLD ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr())); + + RenX_LoggingPlugin::stealFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("StealFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD IRCCOLOR " stole " IRCBOLD "%.*s" IRCBOLD "'s " IRCBOLD "%.*s" IRCBOLD "!", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->victimNameTag.size(), RenX::tags->victimNameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr())); + + RenX_LoggingPlugin::stealNoOwnerFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("StealNoOwnerFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD IRCCOLOR " stole a " IRCBOLD IRCCOLOR "12%.*s" IRCBOLD "!", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr())); + RenX_LoggingPlugin::gameOverFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("GameOverFormat"), Jupiter::StringS::Format(IRCCOLOR "03[Game]" IRCCOLOR "%.*s The " IRCBOLD "%.*s" IRCBOLD " won by " IRCBOLD "%.*s" IRCBOLD, RenX::tags->teamColorTag.size(), RenX::tags->teamColorTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); @@ -138,12 +185,6 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::executeFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("ExecuteFormat"), Jupiter::StringS::Format(IRCCOLOR "07%.*s executed: %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); - RenX_LoggingPlugin::evaFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("EVAFormat"), - Jupiter::StringS::Format(IRCCOLOR "09EVA: %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); - - RenX_LoggingPlugin::evaPrivateFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("EVAPrivateFormat"), - Jupiter::StringS::Format(IRCCOLOR "12(EVA -> %.*s): %.*s", RenX::tags->rawNameTag.size(), RenX::tags->rawNameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); - RenX_LoggingPlugin::subscribeFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("SubscribeFormat"), Jupiter::StringS::Format(IRCCOLOR "03%.*s subscribed to the RCON data stream.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr())); @@ -162,6 +203,39 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::adminFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("AdminFormat"), Jupiter::StringS::Format(IRCCOLOR "07[Admin]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::voteCallFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VoteCallFormat"), + Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] " IRCBOLD "%.*s" IRCBOLD " has called a \"%.*s\" vote.", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr())); + + RenX_LoggingPlugin::voteOverSuccessFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VoteOverSuccessFormat"), + Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" " IRCBOLD IRCCOLOR "09passed" IRCBOLD IRCCOLOR "%.*s (Votes Yes: %.*s | Votes No: %.*s).", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->winScoreTag.size(), RenX::tags->winScoreTag.ptr(), RenX::tags->loseScoreTag.size(), RenX::tags->loseScoreTag.ptr())); + + RenX_LoggingPlugin::voteOverFailFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VoteOverFailFormat"), + Jupiter::StringS::Format(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.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr(), RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->winScoreTag.size(), RenX::tags->winScoreTag.ptr(), RenX::tags->loseScoreTag.size(), RenX::tags->loseScoreTag.ptr())); + + RenX_LoggingPlugin::voteCancelFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VoteCancelFormat"), + Jupiter::StringS::Format(IRCCOLOR "%.*s[Vote] A vote for \"%.*s\" was " IRCBOLD IRCCOLOR "07cancelled" IRCCOLOR IRCBOLD ".", RenX::tags->victimTeamColorTag.size(), RenX::tags->victimTeamColorTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr())); + + RenX_LoggingPlugin::voteFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VoteFormat"), + Jupiter::StringS::Format(IRCCOLOR "06[Vote]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::mapChangeFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapChangeFormat"), + Jupiter::StringS::Format(IRCCOLOR "03Loading %.*s...", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::mapLoadFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapLoadFormat"), + Jupiter::StringS::Format(IRCCOLOR "03%.*s loaded.", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::mapFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapFormat"), + Jupiter::StringS::Format(IRCCOLOR "06[Map]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + + RenX_LoggingPlugin::demoRecordFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DemoRecordFormat"), + Jupiter::StringS::Format("%.*s has started a demo recording.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr())); + + RenX_LoggingPlugin::rconDemoRecordFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("RCONDemoRecordFormat"), + STRING_LITERAL_AS_REFERENCE(IRCCOLOR "07A demo recording has started.")); + + RenX_LoggingPlugin::demoFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DemoFormat"), + Jupiter::StringS::Format(IRCCOLOR "06[Demo]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::logFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("LogFormat"), Jupiter::StringS::Format(IRCCOLOR "07[Log]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); @@ -198,16 +272,19 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::otherFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("OtherFormat"), Jupiter::StringS::Format(IRCCOLOR "06[Other]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); - /** Sanitize tags in formats to prevent explotation */ + /** Sanitize tags */ RenX::sanitizeTags(joinPublicFmt); RenX::sanitizeTags(joinAdminFmt); RenX::sanitizeTags(joinNoSteamAdminFmt); RenX::sanitizeTags(partFmt); RenX::sanitizeTags(nameChangeFmt); RenX::sanitizeTags(teamChangeFmt); + RenX::sanitizeTags(playerFmt); RenX::sanitizeTags(chatFmt); RenX::sanitizeTags(teamChatFmt); + RenX::sanitizeTags(otherChatFmt); RenX::sanitizeTags(deployFmt); + RenX::sanitizeTags(disarmFmt); RenX::sanitizeTags(suicideFmt); RenX::sanitizeTags(dieFmt); RenX::sanitizeTags(dieFmt2); @@ -219,20 +296,36 @@ void RenX_LoggingPlugin::init() RenX::sanitizeTags(destroyDefenceFmt2); RenX::sanitizeTags(destroyVehicleFmt); RenX::sanitizeTags(destroyVehicleFmt2); + RenX::sanitizeTags(captureFmt); + RenX::sanitizeTags(neutralizeFmt); + RenX::sanitizeTags(stealFmt); + RenX::sanitizeTags(stealNoOwnerFmt); RenX::sanitizeTags(gameOverFmt); RenX::sanitizeTags(gameOverTieFmt); RenX::sanitizeTags(gameOverTieNoWinFmt); RenX::sanitizeTags(gameOverScoreFmt); RenX::sanitizeTags(gameFmt); RenX::sanitizeTags(executeFmt); - RenX::sanitizeTags(evaFmt); - RenX::sanitizeTags(evaPrivateFmt); + RenX::sanitizeTags(playerExecuteFmt); + RenX::sanitizeTags(hostChatFmt); + RenX::sanitizeTags(hostPageFmt); RenX::sanitizeTags(subscribeFmt); RenX::sanitizeTags(rconFmt); RenX::sanitizeTags(adminLoginFmt); RenX::sanitizeTags(adminGrantFmt); RenX::sanitizeTags(adminLogoutFmt); RenX::sanitizeTags(adminFmt); + RenX::sanitizeTags(voteCallFmt); + RenX::sanitizeTags(voteOverSuccessFmt); + RenX::sanitizeTags(voteOverFailFmt); + RenX::sanitizeTags(voteCancelFmt); + RenX::sanitizeTags(voteFmt); + RenX::sanitizeTags(mapChangeFmt); + RenX::sanitizeTags(mapLoadFmt); + RenX::sanitizeTags(mapFmt); + RenX::sanitizeTags(demoRecordFmt); + RenX::sanitizeTags(rconDemoRecordFmt); + RenX::sanitizeTags(demoFmt); RenX::sanitizeTags(logFmt); RenX::sanitizeTags(xVersionFmt); RenX::sanitizeTags(grantCharacterFmt); @@ -305,7 +398,7 @@ void RenX_LoggingPlugin::RenX_OnNameChange(RenX::Server *server, const RenX::Pla } } -void RenX_LoggingPlugin::RenX_OnTeamChange(RenX::Server *server, const RenX::PlayerInfo *player) +void RenX_LoggingPlugin::RenX_OnTeamChange(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::TeamType &oldTeam) { logFuncType func; if (RenX_LoggingPlugin::teamChangePublic) @@ -321,6 +414,40 @@ void RenX_LoggingPlugin::RenX_OnTeamChange(RenX::Server *server, const RenX::Pla } } +void RenX_LoggingPlugin::RenX_OnExecute(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &command) +{ + logFuncType func; + if (RenX_LoggingPlugin::executePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->playerExecuteFmt; + if (msg.isEmpty() == false) + { + processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, command); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnPlayer(RenX::Server *server, const Jupiter::ReadableString &raw) +{ + logFuncType func; + if (RenX_LoggingPlugin::playerPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->playerFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, raw); + (server->*func)(msg); + } +} + void RenX_LoggingPlugin::RenX_OnChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) { logFuncType func; @@ -355,6 +482,57 @@ void RenX_LoggingPlugin::RenX_OnTeamChat(RenX::Server *server, const RenX::Playe } } +void RenX_LoggingPlugin::RenX_OnHostChat(RenX::Server *server, const Jupiter::ReadableString &message) +{ + logFuncType func; + if (RenX_LoggingPlugin::hostChatPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->hostChatFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, message); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnHostPage(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) +{ + logFuncType func; + if (RenX_LoggingPlugin::hostPagePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->hostPageFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, message); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnOtherChat(RenX::Server *server, const Jupiter::ReadableString &raw) +{ + logFuncType func; + if (RenX_LoggingPlugin::otherChatPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->otherChatFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, raw); + (server->*func)(msg); + } +} + void RenX_LoggingPlugin::RenX_OnDeploy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) { logFuncType func; @@ -372,6 +550,23 @@ void RenX_LoggingPlugin::RenX_OnDeploy(RenX::Server *server, const RenX::PlayerI } } +void RenX_LoggingPlugin::RenX_OnDisarm(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) +{ + logFuncType func; + if (RenX_LoggingPlugin::disarmPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->disarmFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(object)); + (server->*func)(msg); + } +} + void RenX_LoggingPlugin::RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) { logFuncType func; @@ -406,7 +601,7 @@ void RenX_LoggingPlugin::RenX_OnKill(RenX::Server *server, const RenX::PlayerInf } } -void RenX_LoggingPlugin::RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, RenX::TeamType killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) +void RenX_LoggingPlugin::RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) { logFuncType func; if (RenX_LoggingPlugin::killPublic) @@ -444,7 +639,7 @@ void RenX_LoggingPlugin::RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo } } -void RenX_LoggingPlugin::RenX_OnDie(RenX::Server *server, const Jupiter::ReadableString &object, RenX::TeamType objectTeam, const Jupiter::ReadableString &damageType) +void RenX_LoggingPlugin::RenX_OnDie(RenX::Server *server, const Jupiter::ReadableString &object, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType) { logFuncType func; if (RenX_LoggingPlugin::diePublic) @@ -499,7 +694,81 @@ void RenX_LoggingPlugin::RenX_OnDestroy(RenX::Server *server, const RenX::Player } } -void RenX_LoggingPlugin::RenX_OnDestroy(RenX::Server *server, const Jupiter::ReadableString &killer, RenX::TeamType killerTeam, const Jupiter::ReadableString &objectName, RenX::TeamType objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) +void RenX_LoggingPlugin::RenX_OnCapture(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) +{ + logFuncType func; + if (RenX_LoggingPlugin::capturePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->captureFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(building)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(oldTeam)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(oldTeam)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(oldTeam)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnNeutralize(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) +{ + logFuncType func; + if (RenX_LoggingPlugin::neutralizePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->neutralizeFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(building)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(oldTeam)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(oldTeam)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(oldTeam)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) +{ + logFuncType func; + if (RenX_LoggingPlugin::stealPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->stealNoOwnerFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(vehicle)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle, const RenX::PlayerInfo *victim) +{ + logFuncType func; + if (RenX_LoggingPlugin::stealPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->stealFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player, victim); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(vehicle)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnDestroy(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) { logFuncType func; if (RenX_LoggingPlugin::destroyPublic) @@ -536,7 +805,7 @@ void RenX_LoggingPlugin::RenX_OnDestroy(RenX::Server *server, const Jupiter::Rea } } -void RenX_LoggingPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) +void RenX_LoggingPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) { RenX::TeamType loserTeam = RenX::getEnemy(team); int winScore; @@ -563,7 +832,7 @@ void RenX_LoggingPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType win Jupiter::String msg; if (winType == RenX::WinType::Tie) { - if (team == RenX::TeamType::Other) + if (team == RenX::TeamType::None) msg = this->gameOverTieNoWinFmt; else msg = this->gameOverTieFmt; @@ -571,7 +840,7 @@ void RenX_LoggingPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType win else msg = this->gameOverFmt; - if (msg.isEmpty() == false) + if (msg.isEmpty() == false && team != RenX::TeamType::None) { msg.replace(RenX::tags->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(team)); msg.replace(RenX::tags->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(team)); @@ -586,13 +855,23 @@ void RenX_LoggingPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType win } msg = this->gameOverScoreFmt; - if (team == RenX::TeamType::Other) + if (team == RenX::TeamType::None) { - team = RenX::TeamType::GDI; - loserTeam = RenX::TeamType::Nod; + if (msg.isEmpty() == false) + { + msg.replace(RenX::tags->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(RenX::TeamType::GDI)); + msg.replace(RenX::tags->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(RenX::TeamType::GDI)); + msg.replace(RenX::tags->INTERNAL_TEAM_LONG_TAG, RenX::getFullTeamName(RenX::TeamType::GDI)); + msg.replace(RenX::tags->INTERNAL_WIN_SCORE_TAG, Jupiter::StringS::Format("%d", winScore)); + msg.replace(RenX::tags->INTERNAL_LOSE_SCORE_TAG, Jupiter::StringS::Format("%d", loseScore)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(RenX::TeamType::Nod)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(RenX::TeamType::Nod)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(RenX::TeamType::Nod)); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, RenX::translateWinType(winType)); + (server->*func)(msg); + } } - - if (msg.isEmpty() == false) + else if (msg.isEmpty() == false) { msg.replace(RenX::tags->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(team)); msg.replace(RenX::tags->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(team)); @@ -635,35 +914,7 @@ void RenX_LoggingPlugin::RenX_OnExecute(RenX::Server *server, const Jupiter::Rea else func = &RenX::Server::sendAdmChan; - Jupiter::String msg; - if (command.matchi("say *")) - { - msg = this->evaFmt; - if (msg.isEmpty() == false) - { - processTags(msg, server); - msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, Jupiter::ReferenceString::gotoToken(command, 1, ' ')); - server->sendLogChan(msg); - return; - } - } - else if (command.matchi("evaprivatesay *")) - { - RenX::PlayerInfo *player = server->getPlayerByName(Jupiter::ReferenceString::getToken(command, 1, ' ')); - if (player != nullptr) - { - msg = this->evaPrivateFmt; - if (msg.isEmpty() == false) - { - Jupiter::ReferenceString message = Jupiter::ReferenceString::gotoToken(command, 2, ' '); - processTags(msg, server, player); - msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, message); - (server->*func)(msg); - return; - } - } - } - msg = this->executeFmt; + Jupiter::String msg = this->executeFmt; if (msg.isEmpty() == false) { processTags(msg, server); @@ -773,6 +1024,192 @@ void RenX_LoggingPlugin::RenX_OnAdmin(RenX::Server *server, const Jupiter::Reada } } +void RenX_LoggingPlugin::RenX_OnVoteCall(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player, const Jupiter::ReadableString ¶meters) +{ + logFuncType func; + if (RenX_LoggingPlugin::voteCallPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->voteCallFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team)); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(type)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnVoteOver(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, bool success, int yesVotes, int noVotes) +{ + logFuncType func; + if (RenX_LoggingPlugin::voteOverPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = success ? this->voteOverSuccessFmt : this->voteOverFailFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(type)); + msg.replace(RenX::tags->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(team)); + msg.replace(RenX::tags->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(team)); + msg.replace(RenX::tags->INTERNAL_TEAM_LONG_TAG, RenX::getFullTeamName(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team)); + msg.replace(RenX::tags->INTERNAL_WIN_SCORE_TAG, Jupiter::StringS::Format("%d", yesVotes)); + msg.replace(RenX::tags->INTERNAL_LOSE_SCORE_TAG, Jupiter::StringS::Format("%d", noVotes)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnVoteCancel(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type) +{ + logFuncType func; + if (RenX_LoggingPlugin::voteCancelPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->voteCancelFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(type)); + msg.replace(RenX::tags->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(team)); + msg.replace(RenX::tags->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(team)); + msg.replace(RenX::tags->INTERNAL_TEAM_LONG_TAG, RenX::getFullTeamName(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(team)); + msg.replace(RenX::tags->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(team)); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnVote(RenX::Server *server, const Jupiter::ReadableString &raw) +{ + logFuncType func; + if (RenX_LoggingPlugin::votePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->voteFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, raw); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnMapChange(RenX::Server *server, const Jupiter::ReadableString &map, bool seamless) +{ + logFuncType func; + if (RenX_LoggingPlugin::mapChangePublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->mapChangeFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, map); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) +{ + logFuncType func; + if (RenX_LoggingPlugin::mapLoadPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->mapLoadFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, map); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnMap(RenX::Server *server, const Jupiter::ReadableString &raw) +{ + logFuncType func; + if (RenX_LoggingPlugin::mapPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->mapFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, raw); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnDemoRecord(RenX::Server *server, const RenX::PlayerInfo *player) +{ + logFuncType func; + if (RenX_LoggingPlugin::demoRecordPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->demoRecordFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server, player); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnDemoRecord(RenX::Server *server, const Jupiter::ReadableString &user) +{ + logFuncType func; + if (RenX_LoggingPlugin::demoRecordPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->rconDemoRecordFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->nameTag, user); + (server->*func)(msg); + } +} + +void RenX_LoggingPlugin::RenX_OnDemo(RenX::Server *server, const Jupiter::ReadableString &raw) +{ + logFuncType func; + if (RenX_LoggingPlugin::demoPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->demoFmt; + if (msg.isEmpty() == false) + { + RenX::processTags(msg, server); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, raw); + (server->*func)(msg); + } +} + void RenX_LoggingPlugin::RenX_OnLog(RenX::Server *server, const Jupiter::ReadableString &raw) { logFuncType func; @@ -844,7 +1281,7 @@ void RenX_LoggingPlugin::RenX_OnSpawnVehicle(RenX::Server *server, const RenX::P } } -void RenX_LoggingPlugin::RenX_OnSpawnVehicleNoOwner(RenX::Server *server, const RenX::TeamType team, const Jupiter::ReadableString &vehicle) +void RenX_LoggingPlugin::RenX_OnSpawnVehicleNoOwner(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &vehicle) { logFuncType func; if (RenX_LoggingPlugin::spawnVehicleNoOwnerPublic) diff --git a/RenX.Logging/RenX_Logging.h b/RenX.Logging/RenX_Logging.h index b964aa6..0bba7c5 100644 --- a/RenX.Logging/RenX_Logging.h +++ b/RenX.Logging/RenX_Logging.h @@ -1,5 +1,5 @@ /** - * Copyright (C) 2014 Justin James. + * Copyright (C) 2014-2015 Justin James. * * This license must be preserved. * Any applications, libraries, or code which make any use of any @@ -27,20 +27,30 @@ public: // RenX::Plugin void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnNameChange(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &newPlayerName) override; - void RenX_OnTeamChange(RenX::Server *server, const RenX::PlayerInfo *player) override; + void RenX_OnTeamChange(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::TeamType &oldTeam) override; + void RenX_OnExecute(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &command) override; + void RenX_OnPlayer(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnTeamChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; + void RenX_OnHostChat(RenX::Server *server, const Jupiter::ReadableString &message) override; + void RenX_OnHostPage(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; + void RenX_OnOtherChat(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnDeploy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) override; + void RenX_OnDisarm(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &object) override; void RenX_OnSuicide(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; void RenX_OnKill(RenX::Server *server, const RenX::PlayerInfo *player, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; - void RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, RenX::TeamType killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; + void RenX_OnKill(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const RenX::PlayerInfo *victim, const Jupiter::ReadableString &damageType) override; void RenX_OnDie(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &damageType) override; - void RenX_OnDie(RenX::Server *server, const Jupiter::ReadableString &object, RenX::TeamType objectTeam, const Jupiter::ReadableString &damageType) override; + void RenX_OnDie(RenX::Server *server, const Jupiter::ReadableString &object, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType) override; void RenX_OnDestroy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &objectName, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; - void RenX_OnDestroy(RenX::Server *server, const Jupiter::ReadableString &killer, RenX::TeamType killerTeam, const Jupiter::ReadableString &objectName, RenX::TeamType objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; - void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) override; + void RenX_OnDestroy(RenX::Server *server, const Jupiter::ReadableString &killer, const RenX::TeamType &killerTeam, const Jupiter::ReadableString &objectName, const RenX::TeamType &objectTeam, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; + void RenX_OnCapture(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override; + void RenX_OnNeutralize(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &building, const RenX::TeamType &oldTeam) override; + void RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override; + void RenX_OnSteal(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle, const RenX::PlayerInfo *victim) override; + void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override; void RenX_OnGame(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_OnExecute(RenX::Server *server, const Jupiter::ReadableString &user, const Jupiter::ReadableString &command) override; @@ -52,12 +62,25 @@ public: // RenX::Plugin void RenX_OnAdminLogout(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnAdmin(RenX::Server *server, const Jupiter::ReadableString &raw) override; + void RenX_OnVoteCall(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, const RenX::PlayerInfo *player, const Jupiter::ReadableString ¶meters) override; + void RenX_OnVoteOver(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type, bool success, int yesVotes, int noVotes) override; + void RenX_OnVoteCancel(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &type) override; + void RenX_OnVote(RenX::Server *server, const Jupiter::ReadableString &raw) override; + + void RenX_OnMapChange(RenX::Server *server, const Jupiter::ReadableString &map, bool seamless) override; + void RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) override; + void RenX_OnMap(RenX::Server *server, const Jupiter::ReadableString &raw) override; + + void RenX_OnDemoRecord(RenX::Server *server, const RenX::PlayerInfo *player) override; + void RenX_OnDemoRecord(RenX::Server *server, const Jupiter::ReadableString &user) override; + void RenX_OnDemo(RenX::Server *server, const Jupiter::ReadableString &raw) override; + void RenX_OnLog(RenX::Server *server, const Jupiter::ReadableString &raw) override; void RenX_XOnVersion(RenX::Server *server, unsigned int version) override; void RenX_OnGrantCharacter(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override; void RenX_OnSpawnVehicle(RenX::Server *server, const RenX::PlayerInfo *owner, const Jupiter::ReadableString &vehicle) override; - void RenX_OnSpawnVehicleNoOwner(RenX::Server *server, const RenX::TeamType team, const Jupiter::ReadableString &vehicle) override; + void RenX_OnSpawnVehicleNoOwner(RenX::Server *server, const RenX::TeamType &team, const Jupiter::ReadableString &vehicle) override; void RenX_OnMinePlace(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &mine) override; void RenX_XOnOther(RenX::Server *server, const Jupiter::ReadableString &raw) override; @@ -81,15 +104,23 @@ private: unsigned int partPublic : 1; unsigned int nameChangePublic : 1; unsigned int teamChangePublic : 1; + unsigned int playerPublic : 1; unsigned int chatPublic : 1; unsigned int teamChatPublic : 1; + unsigned int hostChatPublic : 1; + unsigned int hostPagePublic : 1; + unsigned int otherChatPublic : 1; unsigned int deployPublic : 1; + unsigned int disarmPublic : 1; unsigned int suicidePublic : 1; unsigned int killPublic : 1; unsigned int diePublic : 1; unsigned int destroyPublic : 1; - unsigned int gamePublic : 1; + unsigned int capturePublic : 1; + unsigned int neutralizePublic : 1; + unsigned int stealPublic : 1; unsigned int gameOverPublic : 1; + unsigned int gamePublic : 1; unsigned int executePublic : 1; unsigned int subscribePublic : 1; unsigned int RCONPublic : 1; @@ -97,6 +128,15 @@ private: unsigned int adminGrantPublic : 1; unsigned int adminLogoutPublic : 1; unsigned int adminPublic : 1; + unsigned int voteCallPublic : 1; + unsigned int voteOverPublic : 1; + unsigned int voteCancelPublic : 1; + unsigned int votePublic : 1; + unsigned int mapChangePublic : 1; + unsigned int mapLoadPublic : 1; + unsigned int mapPublic : 1; + unsigned int demoRecordPublic : 1; + unsigned int demoPublic : 1; unsigned int logPublic : 1; unsigned int xVersionPublic : 1; unsigned int grantCharacterPublic : 1; @@ -115,9 +155,14 @@ private: Jupiter::StringS partFmt; Jupiter::StringS nameChangeFmt; Jupiter::StringS teamChangeFmt; + Jupiter::StringS playerFmt; Jupiter::StringS chatFmt; Jupiter::StringS teamChatFmt; + Jupiter::StringS hostChatFmt; + Jupiter::StringS hostPageFmt; + Jupiter::StringS otherChatFmt; Jupiter::StringS deployFmt; + Jupiter::StringS disarmFmt; Jupiter::StringS suicideFmt; Jupiter::StringS dieFmt; Jupiter::StringS dieFmt2; @@ -129,18 +174,32 @@ private: Jupiter::StringS destroyDefenceFmt2; Jupiter::StringS destroyVehicleFmt; Jupiter::StringS destroyVehicleFmt2; + Jupiter::StringS captureFmt; + Jupiter::StringS neutralizeFmt; + Jupiter::StringS stealFmt; + Jupiter::StringS stealNoOwnerFmt; Jupiter::StringS gameOverFmt; Jupiter::StringS gameOverTieFmt; Jupiter::StringS gameOverTieNoWinFmt; Jupiter::StringS gameOverScoreFmt; Jupiter::StringS gameFmt; - Jupiter::StringS executeFmt, evaFmt, evaPrivateFmt; + Jupiter::StringS executeFmt, playerExecuteFmt; Jupiter::StringS subscribeFmt; Jupiter::StringS rconFmt; Jupiter::StringS adminLoginFmt; Jupiter::StringS adminGrantFmt; Jupiter::StringS adminLogoutFmt; Jupiter::StringS adminFmt; + Jupiter::StringS voteCallFmt; + Jupiter::StringS voteOverSuccessFmt; + Jupiter::StringS voteOverFailFmt; + Jupiter::StringS voteCancelFmt; + Jupiter::StringS voteFmt; + Jupiter::StringS mapChangeFmt; + Jupiter::StringS mapLoadFmt; + Jupiter::StringS mapFmt; + Jupiter::StringS demoRecordFmt, rconDemoRecordFmt; + Jupiter::StringS demoFmt; Jupiter::StringS logFmt; Jupiter::StringS xVersionFmt; Jupiter::StringS grantCharacterFmt; diff --git a/RenX.Medals/RenX_Medals.cpp b/RenX.Medals/RenX_Medals.cpp index ca592ac..07fc0c6 100644 --- a/RenX.Medals/RenX_Medals.cpp +++ b/RenX.Medals/RenX_Medals.cpp @@ -158,7 +158,7 @@ void RenX_MedalsPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo } } -void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) +void RenX_MedalsPlugin::RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) { if (server->isFirstGame() == false) // No unfair medals for the first game! :D { diff --git a/RenX.Medals/RenX_Medals.h b/RenX.Medals/RenX_Medals.h index 0690eee..0f04070 100644 --- a/RenX.Medals/RenX_Medals.h +++ b/RenX.Medals/RenX_Medals.h @@ -47,7 +47,7 @@ public: // RenX::Plugin void RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) override; void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override; - void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) override; + void RenX_OnGameOver(RenX::Server *server, RenX::WinType winType, const RenX::TeamType &team, int gScore, int nScore) override; void RenX_OnDestroy(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &objectName, const Jupiter::ReadableString &damageType, RenX::ObjectType type) override; RenX_MedalsPlugin(); ~RenX_MedalsPlugin();