diff --git a/Release/Plugins/RenX.Core.lib b/Release/Plugins/RenX.Core.lib index d2d9249..adccc74 100644 Binary files a/Release/Plugins/RenX.Core.lib and b/Release/Plugins/RenX.Core.lib differ diff --git a/RenX.Core/RenX_PlayerInfo.h b/RenX.Core/RenX_PlayerInfo.h index cf28d49..ae0b0bd 100644 --- a/RenX.Core/RenX_PlayerInfo.h +++ b/RenX.Core/RenX_PlayerInfo.h @@ -55,7 +55,7 @@ namespace RenX bool isBot = false; time_t joinTime = 0; - float ping = -1.0f; + unsigned short ping = 0; float score = 0.0f; float credits = 0.0f; unsigned int kills = 0; diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp index 24964e7..fcf195d 100644 --- a/RenX.Core/RenX_Server.cpp +++ b/RenX.Core/RenX_Server.cpp @@ -1095,28 +1095,38 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) header.shiftRight(1); switch (header[0]) { - case 1: // Client list: Normal Player Data | IP | Steam ID | Start Time | Ping | Kills | Deaths | Score | Credits | Class + case 1: // Client list: Normal Player Data | IP | Steam ID | Start Time | Ping Kills | Deaths | Score | Credits | Class header.shiftRight(1); { PARSE_PLAYER_DATA_P(header); PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, playerData.asUnsignedLongLong(0), action); - player->ping = static_cast(buff.getToken(4, RenX::DelimC).asDouble()); - 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)); + Jupiter::ReferenceString pingKillsToken = buff.getToken(4, RenX::DelimC); + if (pingKillsToken.isEmpty() == false) + { + player->ping = static_cast(pingKillsToken.get(0)) * 4; + pingKillsToken.shiftRight(1); + player->kills = pingKillsToken.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)); } header.shiftLeft(1); break; - case 2: // Ping, Score, Credits list: Normal Player Data | Ping | Score | Credits + 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 = static_cast(playerData.asDouble()); - player->score = static_cast(action.asDouble()); - player->credits = static_cast(buff.getToken(3, RenX::DelimC).asDouble()); + if (playerData.isEmpty() == false) + { + player->ping = static_cast(playerData.get(0)) * 4; + playerData.shiftRight(1); + player->score = playerData.asDouble(); + playerData.shiftLeft(1); + } + player->credits = static_cast(action.asDouble()); } header.shiftLeft(1); break; diff --git a/RenX.Core/RenX_Tags.cpp b/RenX.Core/RenX_Tags.cpp index 30fa4ba..6a851d6 100644 --- a/RenX.Core/RenX_Tags.cpp +++ b/RenX.Core/RenX_Tags.cpp @@ -240,7 +240,7 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server, msg.replace(this->INTERNAL_TEAM_COLOR_TAG, RenX::getTeamColor(player->team)); msg.replace(this->INTERNAL_TEAM_SHORT_TAG, RenX::getTeamName(player->team)); msg.replace(this->INTERNAL_TEAM_LONG_TAG, RenX::getFullTeamName(player->team)); - msg.replace(this->INTERNAL_PING_TAG, Jupiter::StringS::Format("%.2f", player->ping)); + msg.replace(this->INTERNAL_PING_TAG, Jupiter::StringS::Format("%hu", player->ping)); msg.replace(this->INTERNAL_SCORE_TAG, Jupiter::StringS::Format("%.0f", player->score)); msg.replace(this->INTERNAL_CREDITS_TAG, Jupiter::StringS::Format("%.0f", player->credits)); msg.replace(this->INTERNAL_KILLS_TAG, Jupiter::StringS::Format("%u", player->kills)); @@ -271,9 +271,9 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server, msg.replace(this->INTERNAL_VICTIM_TEAM_COLOR_TAG, RenX::getTeamColor(victim->team)); msg.replace(this->INTERNAL_VICTIM_TEAM_SHORT_TAG, RenX::getTeamName(victim->team)); msg.replace(this->INTERNAL_VICTIM_TEAM_LONG_TAG, RenX::getFullTeamName(victim->team)); - msg.replace(this->INTERNAL_VICTIM_PING_TAG, Jupiter::StringS::Format("%f", victim->ping)); - msg.replace(this->INTERNAL_VICTIM_SCORE_TAG, Jupiter::StringS::Format("%f", victim->score)); - msg.replace(this->INTERNAL_VICTIM_CREDITS_TAG, Jupiter::StringS::Format("%f", victim->credits)); + msg.replace(this->INTERNAL_VICTIM_PING_TAG, Jupiter::StringS::Format("%hu", victim->ping)); + msg.replace(this->INTERNAL_VICTIM_SCORE_TAG, Jupiter::StringS::Format("%.0f", victim->score)); + msg.replace(this->INTERNAL_VICTIM_CREDITS_TAG, Jupiter::StringS::Format("%.0f", victim->credits)); msg.replace(this->INTERNAL_VICTIM_KILLS_TAG, Jupiter::StringS::Format("%u", victim->kills)); msg.replace(this->INTERNAL_VICTIM_DEATHS_TAG, Jupiter::StringS::Format("%u", victim->deaths)); msg.replace(this->INTERNAL_VICTIM_KDR_TAG, Jupiter::StringS::Format("%.2f", static_cast(victim->kills) / (victim->deaths == 0 ? 1.0f : static_cast(victim->deaths))));