diff --git a/Jupiter b/Jupiter index 6400a15..5a45d44 160000 --- a/Jupiter +++ b/Jupiter @@ -1 +1 @@ -Subproject commit 6400a1542e1d005e47cd5c9989a58a1731e00e27 +Subproject commit 5a45d44a5000587917a5d9ae53fac712e8247e98 diff --git a/Release/Bot.lib b/Release/Bot.lib index a164183..f5d8461 100644 Binary files a/Release/Bot.lib and b/Release/Bot.lib differ diff --git a/Release/Plugins/RenX.Core.lib b/Release/Plugins/RenX.Core.lib index a3c24bf..5efde41 100644 Binary files a/Release/Plugins/RenX.Core.lib and b/Release/Plugins/RenX.Core.lib differ diff --git a/RenX.Core/RenX.h b/RenX.Core/RenX.h index cadc2dc..2b27251 100644 --- a/RenX.Core/RenX.h +++ b/RenX.Core/RenX.h @@ -70,6 +70,8 @@ namespace RenX { SocketError, SocketErrorReconnect, + ProtocolError, + ProtocolErrorReconnect, PingTimeout, PingTimeoutReconnect, IncompatibleVersion, @@ -78,6 +80,8 @@ namespace RenX TriggeredReconnect, Rehash, RehashReconnect, + OtherError, + OtherErrorReconnect, Other, OtherReconnect }; diff --git a/RenX.Core/RenX_PlayerInfo.h b/RenX.Core/RenX_PlayerInfo.h index ae9b108..b3c01f7 100644 --- a/RenX.Core/RenX_PlayerInfo.h +++ b/RenX.Core/RenX_PlayerInfo.h @@ -69,6 +69,8 @@ namespace RenX unsigned int loses = 0; unsigned int beaconPlacements = 0; unsigned int beaconDisarms = 0; + unsigned int proxy_placements = 0; + unsigned int proxy_disarms = 0; unsigned int captures = 0; unsigned int steals = 0; unsigned int stolen = 0; diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp index 81172d2..0dcff13 100644 --- a/RenX.Core/RenX_Server.cpp +++ b/RenX.Core/RenX_Server.cpp @@ -184,6 +184,11 @@ bool RenX::Server::isLogChanType(int type) const return RenX::Server::isPublicLogChanType(type) || RenX::Server::isAdminLogChanType(type); } +bool RenX::Server::isPure() const +{ + return RenX::Server::pure; +} + int RenX::Server::send(const Jupiter::ReadableString &command) { Jupiter::String cmd(command.size() + 2); @@ -923,6 +928,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) player->defenceKills = 0; player->beaconPlacements = 0; player->beaconDisarms = 0; + player->proxy_placements = 0; + player->proxy_disarms = 0; player->captures = 0; player->steals = 0; player->stolen = 0; @@ -1046,6 +1053,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) if (r->name.isEmpty()) { r->name = name; + r->name.processEscapeSequences(); recalcUUID = true; } if (recalcUUID) @@ -1420,6 +1428,23 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) buff.shiftLeft(1); } } + else if (this->lastCommand.equalsi("mutatorlist"_jrs)) + { + // "The following mutators are loaded:" [ | Mutator [ | Mutator [ ... ] ] ] + buff.shiftRight(1); + size_t token_count = buff.tokenCount(RenX::DelimC); + if (token_count == 1) + RenX::Server::pure = true; + else if (token_count == 0) + RenX::Server::disconnect(RenX::DisconnectReason::ProtocolError); + else + { + RenX::Server::mutators.emptyAndDelete(); + while (--token_count != 0) + RenX::Server::mutators.add(new Jupiter::StringS(Jupiter::ReferenceString::getToken(buff, token_count, RenX::DelimC))); + } + buff.shiftLeft(1); + } else if (this->lastCommand.equalsi("changename")) { buff.shiftRight(1); @@ -1445,7 +1470,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC); if (objectType.match("*Beacon")) - player->beaconPlacements++; + ++player->beaconPlacements; + else if (objectType.equals("Rx_Weapon_DeployedProxyC4"_jrs)) + ++player->proxy_placements; for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); onAction(); @@ -1457,7 +1484,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC)); Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC); if (objectType.match("*Beacon")) - player->beaconDisarms++; + ++player->beaconDisarms; + else if (objectType.equals("Rx_Weapon_DeployedProxyC4"_jrs)) + ++player->proxy_disarms; if (buff.getToken(5, RenX::DelimC).equals("owned by")) { @@ -2413,20 +2442,15 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) if (this->rconVersion >= 3) { - RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("s\n")); - RenX::Server::send(STRING_LITERAL_AS_REFERENCE("serverinfo")); + RenX::Server::sock.send("s\n"_jrs); + RenX::Server::send("serverinfo"_jrs); + RenX::Server::send("mutatorlist"_jrs); RenX::Server::fetchClientList(); RenX::Server::updateBuildingList(); this->firstGame = true; this->seamless = true; - /*else if (this->firstGame == false) - { - this->firstAction = false; - this->silenceJoins = true; - }*/ - for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnVersion(this, buff); buff.shiftLeft(1); diff --git a/RenX.Core/RenX_Server.h b/RenX.Core/RenX_Server.h index 1ff9ed1..18e1faf 100644 --- a/RenX.Core/RenX_Server.h +++ b/RenX.Core/RenX_Server.h @@ -84,6 +84,7 @@ namespace RenX public: // RenX::Server Jupiter::DLList players; /** A list of players in the server */ Jupiter::ArrayList buildings; /** A list of buildings in the server */ + Jupiter::ArrayList mutators; /** A list of buildings the server is running */ Jupiter::INIFile varData; /** This may be replaced later with a more dedicated type. */ /** @@ -159,6 +160,13 @@ namespace RenX */ bool isLogChanType(int type) const; + /** + * @brief Checks if a server is "pure" (i.e: not running any mutators). + * + * @return True if the server is pure, false otherwise. + */ + bool isPure() const; + /** * @brief Sends a command to the server. * @@ -814,6 +822,7 @@ namespace RenX void init(); /** Tracking variables */ + bool pure = false; bool connected = false; bool seamless = false; bool passworded = false; diff --git a/RenX.Core/RenX_Tags.cpp b/RenX.Core/RenX_Tags.cpp index 84ad5dd..17dcab3 100644 --- a/RenX.Core/RenX_Tags.cpp +++ b/RenX.Core/RenX_Tags.cpp @@ -285,7 +285,7 @@ Jupiter::StringS TagsImp::get_building_health_bar(const RenX::BuildingInfo *buil return Jupiter::StringS::empty; size_t index = 0; - size_t greenBars = (building->health / building->max_health) * TagsImp::bar_width; + size_t greenBars = static_cast((building->health / building->max_health) * TagsImp::bar_width); Jupiter::String r(TagsImp::bar_width); if (greenBars != 0) { diff --git a/RenX.Logging/RenX_Logging.cpp b/RenX.Logging/RenX_Logging.cpp index 0c1e706..62929d5 100644 --- a/RenX.Logging/RenX_Logging.cpp +++ b/RenX.Logging/RenX_Logging.cpp @@ -115,7 +115,7 @@ void RenX_LoggingPlugin::init() 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::kickFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("KickFormat"), - Jupiter::StringS::Format(IRCCOLOR "04[Kick] " IRCBOLD "%.*s" IRCCOLOR IRCBOLD " was " IRCBOLD IRCCOLOR "04kicked" IRCCOLOR IRCBOLD " from the server for \"" IRCCOLOR "04%.*s" IRCCOLOR "\".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + Jupiter::StringS::Format(IRCCOLOR "04[Kick] " IRCBOLD "%.*s" IRCCOLOR IRCBOLD " was " IRCBOLD IRCCOLOR "04kicked" IRCCOLOR IRCBOLD " (" IRCCOLOR "04%.*s" IRCCOLOR ")", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.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()));