From b36567d32b4ad488bf64327662b19d13f26616ef Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Tue, 14 Oct 2014 05:24:24 -0400 Subject: [PATCH] Added ServerProfile structure; player part event is now silenced for open beta 3. --- Release/Plugins/RenX.Core.lib | Bin 52542 -> 53880 bytes RenX.Core/RenX.Core.vcxproj | 2 + RenX.Core/RenX.Core.vcxproj.filters | 6 +++ RenX.Core/RenX_Server.cpp | 22 ++++++++-- RenX.Core/RenX_Server.h | 3 ++ RenX.Core/RenX_ServerProfile.cpp | 61 ++++++++++++++++++++++++++++ RenX.Core/RenX_ServerProfile.h | 47 +++++++++++++++++++++ 7 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 RenX.Core/RenX_ServerProfile.cpp create mode 100644 RenX.Core/RenX_ServerProfile.h diff --git a/Release/Plugins/RenX.Core.lib b/Release/Plugins/RenX.Core.lib index 246ee2e391b839d25aedc492a958128c6d82f4d4..7158b4be09ef13441c5f94f1fae58373f49c2fc6 100644 GIT binary patch delta 7261 zcmbVQc}$hp5+5z%M$rlaQbEBTk==a(ajS{~Zgr_F3NDC2&KTPBES!p4z^hFzu z$47|-54UO@m`5b2g1+F~6^&1K5eaU6r*S)*NO1A6#;0v8P=L{k-WmrBhy-_GL~tid zV_g7|V9fxH<4#0^B4>@Y`-ub_e%C0>BNF7pNx^zAjkVpO2kd{TQDnhlML;nO3HB#w zYyb^{yc&&)Cq#lxe*j>j{FcUP%n_7FXqej z{u+ldM{opd2(BXl!Tnhp_bkJS?g0-#x!}e=jhoR#f&;&3)PXL+QRG%|1oR7z#%P?$ zAQBwU(Wsb!dI8QSXq-mM1hv0vTmb6=%YzG87&w-sQ9B(9!1<>dx29t205_j#94aPK zaK#h27N=2NM=|J;Vkr5M9vzDc1#bqs;Ge13*6J7i{B+gf zW7jjmT;8OqWl?5oMs#X+a+o2Fnvj|?H7Y7RE_$+qm8j6DXi7|+zc4c~(mE&fZ_G(a zos+yYJ-gwI*?(b~@P?CKH>X9g>Yw)i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@ zuq9G{N65iqo8LFZCXS(eJ(6*pitXd{~nT~^~^pxXU5rdYR1q}%;>Ss?$BYHRBEW5O@&w)b>2scOXr&S-=4LjDYj>= z{UxzFFP1yUXqaww2TAk=mzL#q$4b5fHO9)B3wDQ8-ZRNZ@%1>y6dfAoOg`_TDT2(uL+m`;VD z@g1Z`xl2Ig%JQsS&5+z{!~VEoXNr5d-LP@xhQMCjF^eX{`*oyAn;$*$yaHP$gQ+lE zT2$C3^?0OK7*T(U=E(jE`*;)=@+<$qh(=K~SDxOOSB(P8pw7E_vgiwYhS;5FiL~?P zOYY48x!$R@v#r(VvYW>6K&mXD$`qS&mr5?wT6JC-Ad$BmUBZo7x6Ef_05>KW4S(tQ z_S`N$VF>I^twgzTyQLJb^r+rZZm!Tnhd9$y-Ui<_ z=?$U(rBtz7haF{I!L_57G5D}$vn0Ngr-a-eT9v=WoOUuN#y$J4%oAxfxSq&QHR+<> z{hbb7FWAea=)U8E{Z{=}NaqK3{p_2T@!JyXdB}pa?^>XhiH`* zxg1LHleowBFBMHX`;oZ~jG)eH_TZ0`!WpE?SIKp-tf4~4 + @@ -84,6 +85,7 @@ + diff --git a/RenX.Core/RenX.Core.vcxproj.filters b/RenX.Core/RenX.Core.vcxproj.filters index 4b29fda..e375b38 100644 --- a/RenX.Core/RenX.Core.vcxproj.filters +++ b/RenX.Core/RenX.Core.vcxproj.filters @@ -44,6 +44,9 @@ Header Files + + Header Files + @@ -61,5 +64,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp index 52db0ee..df5b878 100644 --- a/RenX.Core/RenX_Server.cpp +++ b/RenX.Core/RenX_Server.cpp @@ -115,7 +115,7 @@ int RenX::Server::sendMessage(const Jupiter::ReadableString &message) int RenX::Server::sendMessage(RenX::PlayerInfo *player, const Jupiter::ReadableString &message) { - if (RenX::Server::gameVersion.equals("Open Beta 2")) + 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())); @@ -621,6 +621,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) 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); @@ -632,6 +635,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) int nScore = buff.getWord(3, RenX::DelimS).gotoWord(1, "=").asInt(10); this->needsCList = true; + if (this->profile->disconnectOnGameOver) + this->silenceParts = true; + if (gScore == nScore) { onPreGameOver(this, Tie, Other, gScore, nScore); @@ -675,8 +681,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) PARSE_PLAYER_DATA(); if (action.equals("disconnected")) { - for (size_t i = 0; i < xPlugins.size(); i++) - xPlugins.get(i)->RenX_OnPart(this, player); + if (this->silenceParts == false) + for (size_t i = 0; i < xPlugins.size(); i++) + xPlugins.get(i)->RenX_OnPart(this, player); this->removePlayer(player); player = nullptr; } @@ -829,6 +836,14 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) buff.shiftRight(1); this->rconVersion = buff.asInt(10); this->gameVersion = buff.substring(3); + + if (this->rconVersion == 1) + this->profile = RenX::openBeta1Profile; + else if (gameVersion.equals("Open Beta 2")) + this->profile = RenX::openBeta2Profile; + else if (gameVersion.equals("Open Beta 3")) + this->profile = RenX::openBeta3Profile; + for (size_t i = 0; i < xPlugins.size(); i++) xPlugins.get(i)->RenX_OnVersion(this, buff); buff.shiftLeft(1); @@ -870,6 +885,7 @@ bool RenX::Server::connect() 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; } RenX::Server::connected = false; diff --git a/RenX.Core/RenX_Server.h b/RenX.Core/RenX_Server.h index f385867..261283d 100644 --- a/RenX.Core/RenX_Server.h +++ b/RenX.Core/RenX_Server.h @@ -31,6 +31,7 @@ #include "Jupiter/INIFile.h" #include "Jupiter/Thinker.h" #include "RenX.h" +#include "RenX_ServerProfile.h" /** DLL Linkage Nagging */ #if defined _MSC_VER @@ -63,6 +64,7 @@ namespace RenX public: // RenX::Server Jupiter::DLList players; /** A list of players in the server */ Jupiter::INIFile varData; /** This may be replaced later with a more dedicated type. */ + const RenX::ServerProfile *profile = RenX::defaultProfile; /** * @brief Checks if the server is connected to RCON. @@ -419,6 +421,7 @@ namespace RenX private: bool connected = false; bool needsCList = false; + bool silenceParts = false; unsigned int rconVersion = 0; unsigned short port; int logChanType; diff --git a/RenX.Core/RenX_ServerProfile.cpp b/RenX.Core/RenX_ServerProfile.cpp new file mode 100644 index 0000000..e8909a5 --- /dev/null +++ b/RenX.Core/RenX_ServerProfile.cpp @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2014 Justin James. + * + * This license must be preserved. + * Any applications, libraries, or code which make any use of any + * component of this program must not be commercial, unless explicit + * permission is granted from the original author. The use of this + * program for non-profit purposes is permitted. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * In the event that this license restricts you from making desired use of this program, contact the original author. + * Written by Justin James + */ + +#include "RenX_ServerProfile.h" + +struct BaseProfile : RenX::ServerProfile +{ + BaseProfile() + { + supported = true; + privateMessages = true; + disconnectOnGameOver = false; + } +}; + +struct IdealProfile : BaseProfile +{ +} _idealProfile; +const RenX::ServerProfile *RenX::defaultProfile = &_idealProfile; + +struct OpenBeta1Profile : BaseProfile +{ + OpenBeta1Profile() + { + supported = false; + privateMessages = false; + } +} _openBeta1Profile; +const RenX::ServerProfile *RenX::openBeta1Profile = &_openBeta1Profile; + +struct OpenBeta2Profile : BaseProfile +{ + OpenBeta2Profile() + { + privateMessages = false; + } +} _openBeta2Profile; +const RenX::ServerProfile *RenX::openBeta2Profile = &_openBeta2Profile; + +struct OpenBeta3Profile : BaseProfile +{ + OpenBeta3Profile() + { + disconnectOnGameOver = true; + } +} _openBeta3Profile; +const RenX::ServerProfile *RenX::openBeta3Profile = &_openBeta3Profile; diff --git a/RenX.Core/RenX_ServerProfile.h b/RenX.Core/RenX_ServerProfile.h new file mode 100644 index 0000000..07ee519 --- /dev/null +++ b/RenX.Core/RenX_ServerProfile.h @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2014 Justin James. + * + * This license must be preserved. + * Any applications, libraries, or code which make any use of any + * component of this program must not be commercial, unless explicit + * permission is granted from the original author. The use of this + * program for non-profit purposes is permitted. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * In the event that this license restricts you from making desired use of this program, contact the original author. + * Written by Justin James + */ + +#if !defined _RENX_SERVERPROFILE_H_HEADER +#define _RENX_SERVERPROFILE_H_HEADER + +/** + * @file RenX_ServerProfile.h + * @brief Defines the ServerProfile class, and known profiles. + */ + +#include "RenX.h" + +namespace RenX +{ + /** + * @brief Contains information about features supported by a server version. + */ + struct RENX_API ServerProfile + { + bool supported; + bool privateMessages; + bool disconnectOnGameOver; + }; + + RENX_API extern const ServerProfile *defaultProfile; /** Default server profile */ + RENX_API extern const ServerProfile *openBeta1Profile; /** Open Beta 1 server profile */ + RENX_API extern const ServerProfile *openBeta2Profile; /** Open Beta 2 server profile */ + RENX_API extern const ServerProfile *openBeta3Profile; /** Open Beta 3 server profile */ + +} + +#endif // _RENX_SERVERPROFILE_H_HEADER \ No newline at end of file